Point product of two quaternion rotations

I understand that the point (or internal) product of two quaternions is the angle between rotations (including the rotation of the axis). This makes the point product equal to the angle between two points on the hypersurface of the quaternions.
However, I cannot find how to actually calculate a point product.

Any help would be appreciated!

current code:

public static float dot(Quaternion left, Quaternion right){
    float angle;

    //compute

    return angle;
}

Defined by Quaternion.w, Quaternion.x, Quaternion.y and Quaternion.z.

Note. It can be assumed that quaternions are normalized.

+4
source share
3 answers

The quaternion dot product is just a standard 4D Euclidean dot product:

dot = left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w

, , - arccos ( , ): acos(dot).

, , q1 q2, q = q1^-1 * q2, , q.

+9

. acos () .

, q = q1 ^ -1 * q2, = 2 * atan2 (q.vec.length(), q.w)

0

Must be 2 x acos (dot) to get the angle between the quaternions.

0
source

Source: https://habr.com/ru/post/1524959/


All Articles