CreateLinearTransform
This function creates a 3D linear transformation in homogenous coordinates from a user specified set of tuples representing scaling, rotation and translation. The transformations are applied in strict order: first scaling is applied to each axis, then rotations are applied first around X, then around the modified Y and finally around the (twice) modified Z. Translations are applied last, and are applied in global coordinates, rather than in the coordinates described by the transformation.
The transformation is encoded as a 4 x 4 matrix and is applied to vectors encoded [x,y,z,0] or to points encoded [x,y,z,1]. Transforms are generally applied by post-multiplication.
Syntax
Result = CreateLinearTransform()
Arguments
None.
Keywords
SCALE
3-tuple of scaling factors along X, Y and Z axes. The scaling is applied according to the following rule. If the specified scaling factor is greater than 0 then it is treated as a percentage, so a scale factor of 15 corresponds to scaling of 15%, or x 1.15. A negative value is treated as the inverse of the scaling implied by the absolute value. So a scale factor of -15 corresponds to a reduction of scale by 1.15.
ROTATE
3-tuple of rotation about X, Y and Z axes, specified in degrees. Rotations are always applied in order X, Y then Z, and are applied in the local coordinates of the transformation matrix, rather than in global coordinates.
TRANSLATE
3-tuple of translation along X, Y and Z axes. Translation is always applied with respect to the global frame of reference. Note that the units of distance are arbitrary and depend on how the global frame is defined.
Examples
The following example creates a transform that rotates its target around the X axis by 90 degrees, then translates it along the Z axis by 25 units.
xform = CreateLinearTransform($
ROTATE=[90,0,0],TRANSLATE=[0,0,25])