Frequently Asked Questions

 

  1. What interpolation schemes do I need to implement?

 

    1. Catmull-Rom or Bezier for Euler angles
    2. Catmull-Rom or Bezier for Quaternion angle representation
    3. Spherical Linear Interpolation for Quaternion angle representation

 

  1. The matrix given in Shoemake paper for converting from Quaternion to Matrix has different signs than the matrix given in the Parent book (page 452).

 

Use the matrix in the Parent book for converting from quaternions to matrix (page 452).

If you use matrix from Shoemake paper you have to be careful as it represents rotation by q-1 rather than q and because of that some signs are reversed (the paper defines rotation by quaternion as v = q-1*v*q).

 

  1. How to convert from Matrix to Euler angles?

 

Use the formulas on pages (253, 254) of Shoemake paper to compute sin and cos for all angles.

Then use atan2 function to compute the angles:

 

m_real x = atan2( sinx, cosx );

m_real y = atan2( siny, cosy );

m_real z = atan2( sinz, cosz );

 

  1. How do I compute an and bn control points for Bezier curve using quaternion angle representation? The book only explains it for Euclidian space.

 

All the formulas for computing an and bn using quaternion representation are given in Shoemake paper (page 249).

 

  1. Bezier for Quaternions does not work correctly. May be the formulas in the Paper are incorrect?

 

The formulas are correct. We implemented the algorithm using the formulas in the paper and it works.

 

Couple of things to make sure:

    1. Make sure you read paragraph 4.4 on page 250 in Shoemake paper. When you compute an, you can control the quality of the interpolation by brining an closer to qn. The good value is to set (an , qn) segment to 1/3 of the original length. This point is also discussed in Parent book (page 100, third paragraph).
    2. In Double(p, q) = 2(p*q)q p, p*q is a dot product.

 

  1. Is the conversion from Euler angles to quaternions in Shoemake paper correct?

 

Yes. It is correct. I implemented it. Below is my implementation. It exactly follows formulas in the paper.

 

quater EulerAngle2Quater( vector const& v )

{

quater q;

float cosX = cos(v.x()/2.0);

float cosY = cos(v.y()/2.0);

float cosZ = cos(v.z()/2.0);

 

float sinX = sin(v.x()/2.0);

float sinY = sin(v.y()/2.0);

float sinZ = sin(v.z()/2.0);

 

q.set_w(cosX*cosY*cosZ + sinX*sinY*sinZ);

q.set_x(sinX*cosY*cosZ - cosX*sinY*sinZ);

q.set_y(cosX*sinY*cosZ + sinX*cosY*sinZ);

q.set_z(cosX*cosY*sinZ - sinX*sinY*cosZ);

 

return q;

}