Advertisement

absolute value of angel between quarternions ?

Started by January 13, 2003 10:38 AM
2 comments, last by minorlogic 22 years, 1 month ago
I need absolute value of angel between quarternions ? how can i get it ?
acos (innerproduct(&q1, &q2));

Where q1 and q2 are two normalised quaternions, innerproduct is defined as

float innerproduct (quat *q1, quat *q2)
{
return q1->x * q2->x + q1->y * q2->y + q1->z * q2->z + q1->w * q2->w;
}
(any quaternion library will have a version of this function)

If your quaternions are not normalised use:

acos (innerproduct(&q1, &q2) / (length(&q1) * length(&q2));

where length is

float length(quat *q)
{
return sqrt(q->x * q->x + q->y * q->y + q->z * q->z + q->w * q->w);
}

(again a standard quaternion function)
John BlackburneProgrammer, The Pitbull Syndicate
Advertisement

Multiply one quaternion by the inverse of the other.
Convert the result quaternion to an angle/axis.
Ignore the axis.
johnb:
I will try ! Thanks.

lusinho:
Can you tell more about?

how ? "Convert the result quaternion to an angle/axis.
Ignore the axis."

This topic is closed to new replies.

Advertisement