absolute value of angel between quarternions ?
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)
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
Multiply one quaternion by the inverse of the other.
Convert the result quaternion to an angle/axis.
Ignore the axis.

This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement