Compute the rotation matrix given two vectors using Rodrigues' formula

In the previous post, we have shown how angular velocities and rotation matrices are linked through the exponential map, or to be specific, the Rodrigues’ rotation formula. In this post I would like to give as an useful application of Rodrigues’ formula, to compute the rotation matrix between two vectors.

Let $a,b\in\mathbb{R}^3$ ($a\neq b$) be two unit vectors expressed in an arbitary coordinate frame. Our goal is to compute the rotation matrix from $a$ to $b$.

Read more

Conversion between axis angle and quaternion

The following Python function converts a 3 x nf matrix, axisAngles, whose columns are axis-angles, to a 4 x nf matrix of quaternions under the (x,y,z,w) convention. Note that the quaternions should always have norm 1.

Read more