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.
Examples
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. (If you are viewing this topic in the IDL Workbench help, you can click on the code block below to compile the routine, then enter rotateandwriteobject at the IDL command line.)
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
Syntax
XOBJVIEW_ROTATE, Axis, Angle [, /PREMULTIPLY]
Arguments
Axis
A 3-element vector of the form [x, y, z] describing the axis about which the model is to be rotated.
Angle
The amount of rotation, measured in degrees.
Keywords
PREMULTIPLY
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.
Version History
See Also
XOBJVIEW, XOBJVIEW_WRITE_IMAGE