tags:

views:

294

answers:

1

In C++ we can rotate a point about an arbitrary axis:

  void radRotateAxis( float a, float b, float c, float theta )
  {
    float newX = (
      x*( a*a*(1-cos(theta)) + cos(theta)   ) +
      y*( a*b*(1-cos(theta)) - c*sin(theta) ) +
      z*( a*c*(1-cos(theta)) + b*sin(theta) ) );

    float newY = (
      x*( a*b*(1-cos(theta)) + c*sin(theta) ) +
      y*( b*b*(1-cos(theta)) + cos(theta)   ) +
      z*( b*c*(1-cos(theta)) - a*sin(theta) )  );

    float newZ = (
      x*( a*c*(1-cos(theta)) - b*sin(theta) ) +
      y*( b*c*(1-cos(theta)) + a*sin(theta) ) +
      z*( c*c*(1-cos(theta)) + cos(theta)   )  );

    x = newX ;
    y = newY ;
    z = newZ ;
  }

But as we walk theta 0 -> 2PI this takes the point around a "unit circle" around the axis you're rotating about

How can we make it so as theta 0 -> 2PI the results are about an ellipse of width a, height b?

I do not want to apply transformation matrices to the points after rotating them about the axis - what I'm looking for is an "elliptical" rotation matrix, if anyone knows of such a thing!

+6  A: 

Define a matrix A to scale the target ellipse to a suitable unit circle.

Then the composition of A, the rotation matrix, and the inverse of A is your elliptical rotation matrix.

starblue