Atan2 to unit rotation quaternion

128 Views Asked by At

In 3D space, I have an angle theta representing the orientation of the object. This angle is the result of the atan2 function. Using theta, how can I derive the unit quaternion which represents the object's orientation? You can also assume it is happening in 2D space if not possible in 3D.

1

There are 1 best solutions below

3
On

In 3D is not possible. Let's say that $\theta$ is the angle with respect to $z$ axis. The locus of the points at angle $\theta$ with respect to $z$ is a cone. Then a quaternion rotation of the $z$ axis will yield a "generatrix", but you have an infinite number of them.

It is possible in the plane. If $\theta$ is the angle from the $x$ axis towards $y$, then the axis of rotation is $\hat z$, with the rotation angle $\theta$, so $$\mathbf q=\cos\frac\theta2+\hat i 0+\hat j0+\hat k\sin\frac\theta2$$