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
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.
T3D [, Array | , /RESET] [, MATRIX=variable] [, OBLIQUE=vector] [, PERSPECTIVE=p{eye at (0,0,p)}] [, ROTATE=[x, y, z]] [, SCALE=[x, y, z]] [, TRANSLATE=[x, y, z]] [, /XYEXCH | , /XZEXCH | , /YZEXCH]
An optional 4 x 4 matrix used as the starting transformation. If Array is missing, the current
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).
Set this keyword to a named variable that will contain the result. If this keyword is specified,
A two-element vector of oblique projection parameters. Points are projected onto the XY plane at Z=0 as follows:
x' = x + z(d * COS(a)) y' = y + z(d * SIN(a))
where OBLIQUE[0] = d and OBLIQUE[1] = a.
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).
Set this keyword to reset the transformation to the default identity matrix.
A three-element vector of the rotations, in DEGREES, about the X, Y, and Z axes. Rotations are performed in the order of X, Y, and then Z.
A three-element vector of scale factors for the X, Y, and Z axes.
A three-element vector of the translations in the X, Y, and Z directions.
Set this keyword to exchange the X and Y axes.
Set this keyword to exchange the X and Z axes.
Set this keyword to exchange the Y and Z axes.
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] T3D, TRANS = [.5,.5,0]
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.
Introduced: Original