BladePoint
BladePoint

Reputation: 632

Magnitude of rotation between two quaternions

I have a quaternion for an object's starting rotation, and a quaternion for an object's ending rotation, and I am SLERPing the shortest rotation between the two.

How can I figure out the magnitude of the rotation between the object's start and end rotations?

Upvotes: 3

Views: 2886

Answers (1)

minorlogic
minorlogic

Reputation: 1908

Let's introduce two quaternions qStart and qEnd. Magnitude of rotation between them can be expressed as a quaternion:

qRot = qEnd * qStart.inversed();  

and the exact angle of rotation can be extracted as:

2*atan2(qRot.vec.length(), qRot.w);

Upvotes: 4

Related Questions