Sorry for noobish question.
I am trying to make use of quaternion in my work.
I get input which has 2 parts:
Corners of a square polygon, and a quaternion which encodes rotation of this polygon in 3D space.
I read about Quaternion, and understand that it has 4 components(h,a,b,c).
h is Cos(ang/2) where ang is angle of rotation.
a = v1*Sin(ang/2)
b = v2*Sin(ang/2)
c = v3*Sin(ang/2)
Here, v1,v2,v3 are components of unit vector along rotation axis.
So given a quaternion(h,a,b,c), we can find find ang and v1,v2,v3.
My query is that a unit vector(v1,v2,v3) doesn't uniquely represent a vector as all parallel vectors have same unit vector.
So how can we uniquely find axis of rotation? Or do I need to use centre of polygon to do that?
Best Answer
Rotations of three space are a group called $SO(3)$. They are three by three matrices $A$ of determinant $1$ so that $AA^t=Id$. Euler's theorem says that a rotation matrix always has $1$ as an eigenvalue, the line spanned by the eigenvector is the ``axis of rotation''. Notice a line through the origin always intersects the unit sphere in two points. Hence the normalized axis of rotation is ambiguous.
Recall, that if $q=a+x{\bf i} +y{\bf j}+z{\bf k}$ then $\overline{q}=a-x{\bf i} -y{\bf j}-z{\bf k}$. We say $\overline{q}$ is the complex conjugate of $q$. Also $Re(q)=a$ and $Im(q)=x{\bf i} +y{\bf j}+z{\bf k}$. The ``dot product'' in $\mathbb{R}^4$ is given by $$p\cdot q=Re(p\overline{q}).$$ There is an embedding $I:\mathbb{R}^3\rightarrow \mathbb{R}^4$ given by $$I(x{\bf i} +y{\bf j}+z{\bf k})=0+x{\bf i} +y{\bf j}+z{\bf k}.$$ That is we can see $\mathbb{R}^3$ as the {\em purely imaginary} quaternions.
The unit quaternions $q\in \mathbb{R}^4$ are the quaternions so that $q\overline{q}=1$. The unit quaterions form a group, sometimes called $Spin(3)$ or other times called $SU(2)$. There is a map $C:SU(2)\rightarrow SO(3)$ which is given by the action you describe in your question. The way to understand $C$ is as ``conjugation}. The formula for $C$ is $$ C(q)\vec{v}=I^{-1}(qI(\vec{v})\overline{q} ).$$ That is map the vector into $\mathbb{R}^4$ as a purely imaginary quaternion, conjugate by $q$ and then take its inverse image under $I$. Check that if you conjugate a purely imaginary quaternion by a quaternion, the output is purely imaginary, so the formula makes sense.
Notice that $C(q)=C(-q)$ because the minus sign appears twice in the formula. You can check that the map $C$ is $2$-to-$1$. The inverse image of any rotation $A$ is two quaternions $\{q,-q\}$.
Hence the ambiguity in the imaginary part.