This bugzilla service is closed. All entries have been migrated to
Bug 513 - Add FromAxes static function to Quaternion
Summary: Add FromAxes static function to Quaternion
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Geometry (show other bugs)
Version: unspecified
Hardware: All All
: Normal enhancement
Assignee: Nobody
Depends on:
Reported: 2012-09-25 21:23 UTC by Andy Somerville
Modified: 2019-12-04 11:53 UTC (History)
4 users (show)


Description Andy Somerville 2012-09-25 21:23:40 UTC
It would be convenient to have FromAxes to create a fully defined rotation between two frames of reference (analogous to Ogre's Quaternion::FromAxes)

I can quickly produce a patch if this is something that would likely be accepted.
Comment 1 Gael Guennebaud 2012-09-27 00:07:44 UTC
you can already do quat = mat3x3 so I'm not sure a "FromAxes" is that useful?
Comment 2 Andy Somerville 2012-09-27 00:54:19 UTC
You're right, it's certainly hiding that much complexity, though that's true of many parts of the API.

To me, the power of Eigen is that, despite that I've forgotten how to implement half of this stuff, I'm still able to perform powerful geometry calculations A) without having to look up how to do them, and B) while keeping my code clean and uncomplicated.

Using the 3x3 requires knowledge that you can create a rotation matrix by setting the columns to the 3 axes. Elementary perhaps, but when I went to do this very thing, I had forgotten and had to look it up.

I've already added such a function to my (tiny) personal Eigen utility library, but I'm of the opinion that most things that end up in utility libraries should really be in the API of the superordinate library.
Comment 3 Christoph Hertzberg 2012-12-20 16:38:43 UTC
I agree with Gael that it wouldn't add much, o.t.o.h it would not hurt either. It may even add a bit if it has a usefully defined behavior if the axes are not orthonormal. E.g. if the vectors are orthogonal but not orthonormal an obvious choice would be to normalize each vector (for 3x3 matrices it wouldn't be obvious whether rows or columns are normalized).
What shall happen if the 3 axes describe a left-handed system instead of a right-handed? Why would you need the third axis anyways?, if the axes are valid the relation z==x.cross(y) should hold. Should the method do some kind of least-squares fit if that's not the case?

Another question is the name of the method, as there is already a method Quaternion::FromTwoVectors which has a totally different definition (ok, the difference between "Vectors" and "Axes" might be high enough to avoid confusion and I guess you need to look up the definition anyways).
Comment 4 Nobody 2019-12-04 11:53:46 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.