A bit confused on Quaternion 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?
 A: 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.
A: In order to fully describe the rotation, you must have not only the direction of the axis but you must also identify some point that the axis passes through.
In many applications where the points of 3D space are assigned Cartesian coordinates $(x,y,z),$ it is conventional to assume that every rotation axis passes through the point $(0,0,0).$
You can specify an axis that does not pass through $(0,0,0),$ but typically the way to manage that is to specify some point on that axis,
translate the entire space so that that point is translated to $(0,0,0),$
perform the rotation, then reverse the translation.
If you have an axis through the point  $(0,0,0)$ and a vector parallel to that axis, all other vectors parallel to this vector also specify the same axis.
There is no other axis through $(0,0,0)$ parallel to any of those vectors.
The vectors parallel to the given axis also include vectors pointing in the opposite direction, but it is also conventional that the direction in which you rotate the object depends on the sign of the rotation angle and the direction of the vector that identifies the axis. You can reverse the vector and still rotate around the same axis, but to get the same rotation you must then also reverse the angle.
The quaternion representation is not unique, by the way. The quaternions $(h,a,b,c)$ and $(-h,-a,-b,-c)$ are different but represent the same rotation.
