Friday, September 22, 2006

Depicting Rotations via Euler Angles

Here are the promised OBJECT-rotation operators. This actually took me much longer to explain than to create.

Using Mathematica once again, Consider a vector w representing angular velocity by its direction and magnitude. The direction specifies the axis of rotation and the magnitude specifies a positive twist rate in radians per unit time about this axis via the right-hand rule: thumb pointing along the axis, fingers curling in the sense of positive twist. To animate rotations, multiply w by dt to get dw, a small but finite actual rotation. Use "RotateShape," which documentation says "takes Euler angles," to depict such rotations.

Given dw's components, then, what arguments to supply to "RotateShape?" There are lots of different Euler-angle sets. This one turns out to be zxz frame-wise:

xaxis=Line[{{0,0,0},{1,0,0}}];
yaxis=Line[{{0,0,0},{0,1,0}}];
zaxis=Line[{{0,0,0},{0,0,1}}];


Look at the x axis after rotating about +z counterclockwise by a small angle, say p/6. If RotateShape rotates the FRAME, expect a small negative y contribution. If RotateShape rotates the OBJECT, expect a small positive y contribution:


Look at the y axis after a rotation about +x by a small angle. Expect small negative z contribution:


Picture an all-positive w, in the first octant of E3. To rotate the image of an object about such a w via "RotateShape," first get the frame's y axis directly under w by a negative twist about z, then do a negative twist about new x to get z aligned with w, then twist by negative mag[w], to twist the OBJECT rather than the frame, then undo the first two twists.

phi[w] is the angle w makes with the y axis, measured CLOCKwise from y to w in the xy plane. The first Euler angle should be a negative z twist by this angle.


theta[w] is the angle w makes with the z axis, measured counterclockwise from z to w in their common plane. The second Euler angle should be a negative x twist to align the new z axis with w.


Here's the rotation op:


And an animator for it:


And some evidence that it's working right



where

s3p=Show[Graphics3D[#
,FaceGrids->All
,Axes->True
,AxesLabel->{"x","y","z"}
,Lighting->False]
,ImageSize->Automatic]&;

This is good enough to support animation of rigid bodies in motion.

0 Comments:

Post a Comment

<< Home