ROTATE prepares a variable to be rotated by XDEG, YDEG, and ZDEG
degrees around the X, Y, and Z axes. POINTER is the data variable you
wish to ROTATE (see POINTER[3]). If the POINTER argument is omitted,
ROTATE assumes the vector image pointer VECS (see VECS[4]). If 1 or 2 of
the angle arguments are omitted, the current rotation angles for the
missing arguments are preserved.
If all arguments are omitted, ROTATE waits for you to interactively specify 2 vector
positions on the screen, relative to the pinned rotation origin (see PIN[2]).
In this case, the transform is set to rotate VECS around the Z axis first, and then the
X axis (ROTORDER=49 -- see below) as though to make the first vector point along the
direction of the second vector.
When rotating about more than 1 axis, the order in which the rotations are performed
makes a difference. By default, the ROTATE command rotates first around the X axis,
then Y, then Z. You can change the rotation order by specifying the ROTORDER argument.
This is a flag with 32-bit fields:
aabbcc
where AA is the 1st, BB the 2nd, and CC the 3rd rotation axes. For each axis, 0 is X,
1 is Y, and 2 is Z. Thus, the normal default rotation order is X then Y then Z, and
IFLAG is: 0 1 2 -> 00 01 10 -> 000110b -> 6.
Note: ROTATE only sets up the variable for rotation; the effect of ROTATE
will not normally be seen until after you REDRAW or TRANSFORM the variable
(see REDRAW[2] and TRANSFORM[3]).
Examples,
1) rotate vecs 0 0 90 ; set rotation of variable VECS
redraw ; show rotated vector image
2) rotate 30 30 0 ; set VECS rotation about X and Y axes
redraw
3) declare image img1 ; declare an image variable, IMG1
declare pointer ptr ; declare a pointer variable, PTR
img1 = @0(0:199,0:199) ; copy part of screen image to IMG1
ptr = pointer(img1) ; set PTR as pointer to IMG1
pin ptr 100 100 0 ; fix the rotation origin in center
rotate ptr 0 0 45 ; set rotation about Z axis
scale ptr 2 2 1 ; set scale parameters
@0 = transform(ptr) ; load transformed image onto screen
See also: REDRAW[2], GRAPHICS[1], POINTER[3], SCALE[2], OFFSET[2], PIN[2],
TRANSFORM[3].