Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Rotation matrix
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Axis and angle === {{Main|Axis–angle representation}} To efficiently construct a rotation matrix {{mvar|Q}} from an angle {{mvar|θ}} and a unit axis {{math|'''u'''}}, we can take advantage of symmetry and skew-symmetry within the entries. If {{mvar|x}}, {{mvar|y}}, and {{mvar|z}} are the components of the unit vector representing the axis, and :<math>\begin{align} c &= \cos \theta\\ s &= \sin \theta\\ C &= 1-c \end{align}</math> then :<math>Q(\theta) = \begin{bmatrix} xxC+c & xyC-zs & xzC+ys\\ yxC+zs & yyC+c & yzC-xs\\ zxC-ys & zyC+xs & zzC+c \end{bmatrix}</math> Determining an axis and angle, like determining a quaternion, is only possible up to the sign; that is, {{math|('''u''', ''θ'')}} and {{math|(−'''u''', −''θ'')}} correspond to the same rotation matrix, just like {{math|''q''}} and {{math|−''q''}}. Additionally, axis–angle extraction presents additional difficulties. The angle can be restricted to be from 0° to 180°, but angles are formally ambiguous by multiples of 360°. When the angle is zero, the axis is undefined. When the angle is 180°, the matrix becomes symmetric, which has implications in extracting the axis. Near multiples of 180°, care is needed to avoid numerical problems: in extracting the angle, a [[Atan2|two-argument arctangent]] with {{math|[[atan2]](sin ''θ'', cos ''θ'')}} equal to {{mvar|θ}} avoids the insensitivity of arccos; and in computing the axis magnitude in order to force unit magnitude, a brute-force approach can lose accuracy through underflow {{Harv|Moler|Morrison|1983}}. A partial approach is as follows: :<math>\begin{align} x &= Q_{zy} - Q_{yz}\\ y &= Q_{xz} - Q_{zx}\\ z &= Q_{yx} - Q_{xy}\\ r &= \sqrt{x^2 + y^2 + z^2}\\ t &= Q_{xx} + Q_{yy} + Q_{zz}\\ \theta &= \operatorname{atan2}(r,t-1)\end{align}</math> The {{mvar|x}}-, {{mvar|y}}-, and {{mvar|z}}-components of the axis would then be divided by {{mvar|r}}. A fully robust approach will use a different algorithm when {{mvar|t}}, the [[Trace (linear algebra)|trace]] of the matrix {{mvar|Q}}, is negative, as with quaternion extraction. When {{mvar|r}} is zero because the angle is zero, an axis must be provided from some source other than the matrix.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)