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
- Matrix3D ( Array [ Number ] ) |
- methodclone ( )
- methodcoordinateSystem ( Point3D , Vector3D , Vector3D , Vector3D ) |
- methoddeterminant ( )
- propertyelements
- methodequals ( Matrix3D or Object )
- methodidentity ( ) |
- methodinvert ( ) |
- methodrotationX ( Number ) |
- methodrotationY ( Number ) |
- methodrotationZ ( Number ) |
- methodscaling ( Vector3D or Number or Array [ Number ] , Number , Number ) |
- methodtoJSON ( )
- methodtransform ( Matrix3D or Array [ Number ] ) |
- methodtranslation ( Vector3D or Number or Array [ Number ] , Number , Number ) |
Class Member Details
• Matrix3D ([elements]) |
The following parameters can be specified in the constructor:
• Matrix3D clone()
Creates a copy of this object and returns it.
• Matrix3D coordinateSystem (origin, xAxis, yAxis, zAxis) |
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() |
Modifies all elements of this matrix to repressent an identity matrix.
• Matrix3D invert() |
Inverts this transformation matrix.
• Matrix3D rotationX (angle) |
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) |
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) |
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]) |
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. |
- z: Number - The Z scale, when only the X scale is specified as the first argument. |
• JSON toJSON()
Overrides the default serialization process of JSON.stringify method, and
returns the serialized JSON.
• Matrix3D transform (matrix) |
Transforms this matrix by another transformation matrix. The input matrix is stored as row major.
• Matrix3D translation (direction, [y], [z]) |
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. |
- z: Number - The Z offset to move in, when only the X offset is specified as the first argument. |