The T3D procedure implements three-dimensional transforms.
This routine accumulates one or more sequences of translation, scaling, rotation, perspective, and oblique transformations and stores the result in !P.T, the 3D transformation system variable. All the IDL graphic routines use this (4,4) matrix for output. Note that !P.T3D is not set, so for the transformations to have effect you must set !P.T3D = 1 (or set the T3D keyword in subsequent calls to graphics routines).
This procedure is based on that of Foley & Van Dam, Fundamentals of Interactive Computer Graphics , Chapter 8, "Viewing in Three Dimensions". The matrix notation is reversed from the normal IDL sense, i.e., here, the first subscript is the column, the second is the row, in order to conform with this reference.
A right-handed system is used. Positive rotations are counterclockwise when looking from a positive axis position towards the origin.
This routine is written in the IDL language. Its source code can be found in the file
t3d.pro
in the
lib
subdirectory of the IDL distribution.
Any, all, or none of the following keywords can be present in a call to T3D. The order of the input parameters does not matter.
The transformation specified by each keyword is performed in the order of their descriptions below (e.g., if both TRANSLATE and SCALE are specified, the translation is done first).
A two-element vector of oblique projection parameters. Points are projected onto the XY plane at Z=0 as follows:
Perspective transformation. This parameter is a scalar (p) that indicates the Z distance of the center of the projection. Objects are projected into the XY plane at Z=0, and the "eye" is at point (0,0,p).
To reset the transformation, rotate 30 degs about the X axis and do perspective transformation with the center of the projection at Z = -1, X=0, and Y=0, enter:
T3D, /RESET, ROT = [ 30,0,0], PERS = 1.
Transformations may be cascaded, for example:
T3D, /RESET, TRANS = [-.5,-.5,0], ROT = [0,0,45]
The first command resets, translates the point (.5,.5,0) to the center of the viewport, then rotates 45 degrees counterclockwise about the Z axis. The second call to T3D moves the origin back to the center of the viewport.