Talk:Quaternions and spatial rotation: Difference between revisions

Content deleted Content added
Jalexiou (talk | contribs)
Recover Axis Angle: new section
Line 956:
 
:I already reversed the bot edit a few minutes ago. [https://en.wikipedia.org/w/index.php?title=Quaternions_and_spatial_rotation&diff=1067782018&oldid=1067781032] I'll just nod and pretend I knew for sure it wasn't vandalism. Cheers. <small><sub>''signed'', </sub></small>[[User:Willondon|Willondon]] ([[User Talk:Willondon|talk]]) 04:14, 25 January 2022 (UTC)
 
== Recover Axis Angle ==
 
Since quaternions are rotations about arbitrary axis, it makes sense as a matter of convention that the angle is ''always'' a non-negative number. Moreover, the angle must always be in the 1st and 2nd quadrant as all other quadrants have equivalent negative angles. If for example we want to represent a rotation of <math>-\frac{\pi}{6}</math> about the <math>\bigl( \begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix} \bigr)</math> axis, this is entirely equivalent to a rotation of <math>\frac{\pi}{6}</math> about the <math>\bigl( \begin{smallmatrix} -1 \\ 0 \\ 0 \end{smallmatrix} \bigr)</math> axis.
 
So indeed the formula to recover the rotation angle presented <math>\theta = 2\, {\rm arctan2} \left(\sqrt{x^2+y^2+z^2},\,w\right)</math> will indeed produce the correct answer, in the 1st and 2nd quadrants because thee first argument is always going to be positive, but it is un-necessarily complicated. I propose to recover the angle we simply use
 
<math display="block">\theta =2\, \arccos \left(w \right)</math>
 
which also produces results in the 1st and 2nd quadrants, Once the angle is recovered, then the axis is simply the vector part divided by the sine of the half angle
 
<math display="block">\vec{\rm z} = \tfrac{1}{\sin \left( \frac{\theta}{2} \right) }\,\vec{v}</math>