# Arbitrary Axis Rotation

Previously we approached arbitrary axis rotation by viewing it as the composition of several major axis rotations. Now we will look at the rotation in a more straightforward fashion. When a point rotates about an axis, that point will travel in a circle. That circle lies in some plane. Therefore, if we could describe the plane of rotation we could describe our rotation as a 2D rotation in this plane. This will allow us to leverage the 2D matrix rotation that we have already developed.

## Vector Representation

To begin with, say we want to rotate by an angle of $\theta$ about an axis that passes through the origin and is parallel to the unit vector $\vec{v}$. We will define the vector $\vec{p}$ to be the vector that in standard position points to the point to be rotated $P$.

Notice that the path of the point $P$ as it revolves about the axis is a circle. We would like to describe a coordinate system for the plane that this path lies in. More specifically, we would like to define a $\vec{i}^*$ and $\vec{j}^*$ that will be the standard unit normals in this plane. These will serve the same roll as the standard unit normals $\vec{i}$ and $\vec{j}$ in the *xy*-plane. We can leverage our vector operations to create these new unit normals.

First we will define $\vec{i}^*$, to be the unit normal that points from the center of our rotation towards our point $P$.

Therefore this vector is in the direction of the perpendicular projection of $\vec{p}$ onto $\vec{v}$, but with unit length.

(1)We would like $\vec{j}^*$ to be a unit vector perpendicular to both $\vec{i}^*$ and $\vec{v}$, so we can use the cross product of those two vectors. We just need to be careful to choose the order such that the rotation ends up following the right-hand rule.

(2)Note that since both $\vec{i}^*$ and $\vec{v}$ are unit vectors, their cross product is already a unit vector and requires no scaling.

So looking down our axis of rotation toward the origin, we would have the following picture.

In this new rotation space our point $P$ could be represented by the vector $\left < |\mbox{Proj}_\vec{v}\vec{p}|,0 \right >$ . Now we use our 2D rotation matrix to rotate this point in the rotation plane.

(3)So what we have here is the representation of our new point in the rotation plane in terms of $\vec{i}^*$ and $\vec{j}^*$. Now we need to express this in terms of our standard $\vec{i}$, $\vec{j}$, and $\vec{k}$ of the 3D space. So we would need to travel from the origin along the rotation axis to the origin of our rotation plane and then follow our rotated vector in the rotation plane.

(4)## Quaternion Representation

The vector operations we used in the above development can be written as a pair of quaternion multiplications.

If we want to rotate a point $P$ represented by the vector $\vec{p}$. about the line through the origin parallel to the unit vector $\vec{v}$ by an angle of $\theta$, our new vector $\vec{p_r}$ would be,

where $q=[\cos \frac{\theta}{2},\vec{v}\sin \frac{\theta}{2}]$ and $p=[0,\vec{p}]$

Notice that our rotator quaternion $q$ has the special property that it is a unit quaternion, therefore

Exercise

Use quaternion multiplication to rotate the point $(0,2,0)$ about the axis through the origin parallel to $\left < 1,1,1 \right >$ by an angle of $90^\circ$ according to the right hand rule.

## Numberphile Video

## Gimbal Lock Demonstration

## Interactive Quaternion Rotations

# SLERP

Linear Interpolation (LERP) gives us a constant velocity parametrization of the path of least distance between two points. This path of shortest distance is a line segent. In 3D, when restricted to the surface of a sphere, the shortest distance between two points is a **great arc**. A great arc is a portion of a **great circle** which is a circle lying on the sphere that shares its center with the sphere. In geometry on a given surface the shortest distance between two points is referred to as a **geodesic**.

A Spherical Interpolation (SLERP) is a constant velocity parametrization of the path of least distance between two points when restricted to the surface of a sphere. What we will attempt to do now is find this parametrization. (Under Construction)

# Exercises

- Explain what $\vec{i}^*$ and $\vec{j}^*$ represent in our arbitrary axis rotation.
- How is the direction of rotation determined in our arbitrary axis rotation?
- Under what conditions do the two quaternions $q^{-1}$ and $q^*$ equal one another?
- What would the rotator quaternion be in rotating by $45^\circ$ about the axis parallel to $\vec{v}= \left < 2,1,3 \right >$ by the right hand rule?
- Use quaternion multiplication to rotate the point $(2,0,0)$ about the axis parallel to $\vec{v}= \left < 0,5,0 \right >$ by $90^\circ$ according to the right hand rule.
- Use quaternion multiplication to rotate the point $(3,-1,4)$ about the axis parallel to $\vec{v}= \left < 2,1,3 \right >$ by $45^\circ$ according to the right hand rule.