Autodesk Creative Platform Core Version 1.19.0
A broad and deep collection of 2D and 3D capabilities.

Matrix3D Overview

A 4x4 Transformation matrix intended to be used with 3D geometries.
  • Transformation methods are assumed to be right-handed.
  • Elements are stored in row-major form when accessed or modified:
  • Scaling is stored diagonally, translation is stored in the last row:


See Also: Point3D.transform, Vector3D.transform

Introduced in Version: 1.1.0

Class Member Summary

Class Member Details

• Matrix3D ([elements]) | Constructor

The following parameters can be specified in the constructor:
  • elements: Array [ Number ] - A 16-element array of matrix elements. If not provided, then a default identity matrix is prepared. | Optional

Matrix3D clone()

Creates a copy of this object and returns it.

Matrix3D coordinateSystem (origin, xAxis, yAxis, zAxis) | Chainable

Specifies a rotation matrix that translates an object based on the origin and aligns it based on the X, Y and Z axes supplied. The X, Y and Z axes should be orthogonal to eachother.
  • origin: Point3D - Specifies where the point (0,0,0) should be located after applying the matrix.
  • xAxis: Vector3D - Specifies where the axis (1,0,0) should be directed after applying this matrix.
  • yAxis: Vector3D - Specifies where the axis (0,1,0) should be directed after applying this matrix.
  • zAxis: Vector3D - Specifies where the axis (0,0,1) should be directed after applying this matrix.

Number determinant()

Calculates the determinant of the matrix and returns it.

Array [ Number ] elements

The Row-Major Array of 16 numbers repressenting the transformation matrix.

Boolean equals (other)

Returns true if the objects are equal within tolerance (1e-6), otherwise false.

Matrix3D identity() | Chainable

Modifies all elements of this matrix to repressent an identity matrix.

Matrix3D invert() | Chainable

Inverts this transformation matrix.

Matrix3D rotationX (angle) | Chainable

Modifies the elements of this matrix to represent the rotation around the X axis (on the YZ plane) specified by the arguments. Caller may want to make it an identity matrix, prior to calling this method.
  • angle: Number - The angle of rotation in radians (counter-clockwise / right-handed).

Matrix3D rotationY (angle) | Chainable

Modifies the elements of this matrix to repressent the rotation around the Y axis (on the XZ plane) specified by the arguments. Caller may want to make it an identity matrix, prior to calling this method.
  • angle: Number - The angle of rotation in radians (counter-clockwise / right-handed).

Matrix3D rotationZ (angle) | Chainable

Modifies the elements of this matrix to repressent the rotation around the Z axis (on the XY plane) specified by the arguments. Caller may want to make it an identity matrix, prior to calling this method.
  • angle: Number - The angle of rotation in radians (counter-clockwise / right-handed).

Matrix3D scaling (scale, [y], [z]) | Chainable

Modifies the elements of this matrix to represent the scaling specified by the arguments. Caller may want to make it an identity matrix, prior to calling this method.
  • scale: Vector3D or Number or Array [ Number ] - A scale by a Vector3D, an Array with 3 values (X, Y, Z), or a number representing the X scale.
  • y: Number - The Y scale, when only the X scale is specified as the first argument. | Optional
  • z: Number - The Z scale, when only the X scale is specified as the first argument. | Optional

JSON toJSON()

Overrides the default serialization process of JSON.stringify method, and returns the serialized JSON.

Matrix3D transform (matrix) | Chainable

Transforms this matrix by another transformation matrix. The input matrix is stored as row major.

Matrix3D translation (direction, [y], [z]) | Chainable

Modifies the elements of this matrix to represent the translation specified by the arguments. Caller may want to make it an identity matrix, prior to calling this method.
  • direction: Vector3D or Number or Array [ Number ] - A direction of movement defined by a Vector3D, an Array with 3 values (X and Y), or a number repressenting the X offset.
  • y: Number - The Y offset to move in, when only the X offset is specified as the first argument. | Optional
  • z: Number - The Z offset to move in, when only the X offset is specified as the first argument. | Optional