The XOBJVIEW_ROTATE procedure is used to programmatically rotate the object currently displayed in XOBJVIEW. XOBJVIEW must be called prior to calling XOBJVIEW_ROTATE. This procedure can be used to create animations of object displays.
This routine is written in the IDL language. Its source code can be found in the file xobjview_rotate.pro in the lib/utilities subdirectory of the IDL distribution.
XOBJVIEW_ROTATE, Axis, Angle [, /PREMULTIPLY]
A 3-element vector of the form [x, y, z] describing the axis about which the model is to be rotated.
The amount of rotation, measured in degrees.
Set this keyword to cause the rotation matrix specified by Axis and Angle to be pre-multiplied to the model’s transformation matrix. By default, the rotation matrix is post-multiplied.
The following example creates an animation of the test object (a surface) currently displayed in XOBJVIEW. It does this by rotating the surface through 360 degrees in increments of 10 degrees using XOBJVIEW_ROTATE, and writing the display image to a BMP file for each increment using XOBJVIEW_WRITE_IMAGE.
The following lines of code would be saved in a single file, named rotateandwriteobject.pro. Compile the file and enter rotateandwriteobject at the IDL command line to run the code.
PRO RotateAndWriteObject
XOBJVIEW, /TEST
FOR i = 0, 359, 10 DO BEGIN
XOBJVIEW_ROTATE, [0, 1, 0], 10, /PREMULTIPLY
XOBJVIEW_WRITE_IMAGE, 'img' + $
STRCOMPRESS(i, /REMOVE_ALL) + '.bmp', 'bmp'
ENDFOR
END
5.5 |
Introduced |