Transform

Transform

Transform

Constructor

new Transform(diagonalValue)

Initializes a new transform matrix with a specified value along the diagonal.
Parameters:
Name Type Description
diagonalValue double Value to assign to all diagonal cells except M33 which is set to 1.0.

Members

isIdentity :bool

Return true if this Transform is the identity transform
Type:
  • bool

isValid :bool

Gets a value indicating whether or not this Transform is a valid matrix. A valid transform matrix is not allowed to have any invalid numbers.
Type:
  • bool

isZero :bool

True if matrix is Zero4x4, ZeroTransformation, or some other type of zero. The value xform[3][3] can be anything.
Type:
  • bool

isZero4x4 :bool

True if all values are 0
Type:
  • bool

isZeroTransformation :bool

True if all values are 0, except for M33 which is 1.
Type:
  • bool

Methods

(static) identity()

...

(static) rotation(angleRadians, rotationAxis, rotationCenter) → {Transform}

Constructs a new rotation transformation with specified angle, rotation center and rotation axis.
Parameters:
Name Type Description
angleRadians double Angle (in Radians) of the rotation.
rotationAxis Array.<x, y, z> Axis direction of rotation operation.
rotationCenter Array.<x, y, z> Center point of rotation. Rotation axis is vertical.
Returns:
A transformation matrix which rotates geometry around an anchor point.
Type
Transform

(static) scale(anchor, scaleFactor) → {Transform}

Constructs a new uniform scaling transformation with a specified scaling anchor point.
Parameters:
Name Type Description
anchor Array.<x, y, z> Defines the anchor point of the scaling operation.
scaleFactor double Scaling factor in all directions.
Returns:
A transform matrix which scales geometry uniformly around the anchor point.
Type
Transform

(static) translation(dx, dy, dz) → {Transform}

Constructs a new translation (move) transformation. Right column is (dx, dy, dz, 1.0).
Parameters:
Name Type Description
dx double Distance to translate (move) geometry along the world X axis.
dy double Distance to translate (move) geometry along the world Y axis.
dz double Distance to translate (move) geometry along the world Z axis.
Returns:
A transform matrix which moves geometry with the specified distances.
Type
Transform

(static) unset()

...

(static) zeroTransformation()

...

determinant()

...

toFloatArray()

Return the matrix as a linear array of 16 float values

transformBoundingBox() → {BoundingBox}

Computes a new bounding box that is the smallest axis aligned bounding box that contains the transformed result of its 8 original corner points.
Returns:
A new bounding box.
Type
BoundingBox

transpose()

Flip row/column values

tryGetInverse() → {Array}

Attempts to get the inverse transform of this transform.
Returns:
[bool, Transform]
  • (bool) true on success. If false is returned and this Transform is Invalid, inserveTransform will be set to this Transform. If false is returned and this Transform is Valid, inverseTransform will be set to a pseudo inverse.
  • (Transform) The inverse transform. This out reference will be assigned during this call.
Type
Array