The VERT_T3D function transforms a 3-D array by a 4x4 transformation matrix. The 3-D points are typically an array of polygon vertices that were generated by SHADE_VOLUME or MESH_OBJ.

This routine is written in the IDL language. Its source code can be found in the file vert_t3d.pro in the lib subdirectory of the IDL distribution.

Examples


Transform four points representing a square in the x-y plane by first translating +2.0 in the positive X direction, and then rotating 60.0 degrees about the Y axis.

points = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], $
          [1.0, 1.0, 0.0], [0.0, 1.0, 0.0]]
T3D, /RESET
T3D, TRANSLATE=[2.0, 0.0, 0.0]
T3D, ROTATE=[0.0, 60.0, 0.0]
points = VERT_T3D(points)

Syntax


Result = VERT_T3D( Vertex_List [, DOUBLE=value] [, MATRIX=4x4_array] [, /NO_COPY] [, /NO_DIVIDE [, SAVE_DIVIDE=variable] )

Return Value


Returns the single- or double-precision coordinates of the transformed array.

Arguments


Vertex_List

A 3 x n array of 3-D coordinates to transform.

Keywords


DOUBLE

Set this keyword to a non-zero value to indicate that the returned coordinates should be double-precision. If this keyword is not set, the default is to return single-precision coordinates (unless double-precision arguments are input, in which case the DOUBLE keyword is implied to be non-zero).

MATRIX

The 4x4 transformation matrix to use. The default is to use the system viewing matrix (!P.T).

NO_COPY

Normally, a copy of Vertex_list is transformed and the original Vertex_list is preserved. If NO_COPY is set, however, then the original Vertex_List will be undefined after the call to VERT_T3D. Using the NO_COPY requires less memory.

NO_DIVIDE

Normally, when a [x, y, z, 1] vector is transformed by a 4x4 matrix, the final homogeneous coordinates are obtained by dividing the x, y, and z components of the result vector by the fourth element in the result vector. Setting the NO_DIVIDE keyword will prevent VERT_T3D from performing this division. In some cases (usually when a perspective transformation is involved) the fourth element in the result vector can be very close to (or equal to) zero.

SAVE_DIVIDE

Set this keyword to a named variable that will hold receive the fourth element of the transformed vector(s). If Vertex_list is a vector then SAVE_DIVIDE is a scalar. If Vertex_list is an array then SAVE_DIVIDE is an array of n elements. This keyword only has effect when the NO_DIVIDE keyword is set.

Version History


Pre-4.0

Introduced

See Also