Does anyone know a way to decompose a Transformation to an axis (a point and vector) and an angle? What I need is the opposite of Transformation.rotation, not X rotation, Y rotation and Z rotation (which I know have been covered before in the forum). I think the rotation axis I’m looking for is called an eigenvector but I don’t know how to find it. This math is way beyond what I’ve ever studied in school.
Speaking non-mathematically, that doesn’t sound like enough information to specify a unique transformation. What is the plane of the angle?
Or is it ‘around’ the vector? If so, that would enough, intuition tells me. But it wouldn’t account for any scaling, unless the length of the vector relative to a unit vector were used to give uniform scale. Wouldn’t account for non-uniform scale though.
Can you show diagrammatically, what you are trying to achieve?
PS. Have you read the Wikipedia article about eigenvalues and eigenvectors?
[Edit: broken link corrected]
I’ve read up a bit on Quaternions and other methods but it seems quite complicated. I was hoping there was already a finished library or something out there but I can’t find any and implementing it all from scratch is just too much work for this project. I think I’ll find another way around this.
I agree with Colin, you need to use a matrix to quaternion function, then convert the quaternion back to axis and angle.
Quaternions are essentially axis-angle representations, so the last step should be fairly simple.
I have used axis angle for animations. I created a Ruby version, developing from Wikipedia’s Axis-Angle article, as well as:
The Brannon PDF includes Fortran source code.
The angle isn’t that hard to obtain. The rotation axis is difficult at angles near zero and pi.
I have attached a version in Ruby. bhy_euler_axisangle.rb (15.4 KB)
I had to heavily edit it to remove my other utilities, and it was only tested for one angle/axis.
Someone with the background (@Aerilius ?) should give it a through peer review, not to mention unit testing.
I have moved on to using the Eigen library version of axis-angle in a Ruby C extension, and it is a bit faster. If I use the method (“Bhy::Utilities.get_AxisAngle”), it is always called outside an animation loop.