Rotate
The Rotate function computes a matrix that performs a counterclockwise rotation of angle degrees about the vector from the origin through the point (x, y, z).
Rotate( angle, x, y, z);
Arguments
angle
The angle of rotation, in degrees.
x, y, z
The x, y, and z coordinates of a vector, respectively.
Remarks
In an Actor Script, this has the effect of rotating the actor about the vector [x,y,z] through the origin through angle degrees (computed using the right-hand rule). It does not affect the position or orientation of other actors. Use this to position actors in the scene. Within the glDraw {...} protocol, you should use PushMatrix and PopMatrix as described below to leave the scene undisturbed. For example:
gldraw {
pushmatrix();
rotate(30,1,0,0);
solidoctahedron(2);
popmatrix();
refresh();
}
The final refresh() is to remove the anonymous actor. The overall effect is to create a (temporary) rotated octahedron in the scene leaving the other actors fixed.
The current matrix (see MatrixMode) is multiplied by this rotation matrix, with the product replacing the current matrix. That is, if M is the current matrix and R is the rotation matrix, then M is replaced with M·R.
If the matrix mode is either GL_MODELVIEW or GL_PROJECTION, all objects drawn after Rotate is called are rotated. Use PushMatrix and PopMatrix to save and restore the unrotated coordinate system.
Note: Do not call Rotate between a call to Begin and the corresponding call to End.
See Also