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

# Matrix2D Overview

A 3x3 Transformation matrix intended to be used with 2D 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:
• Introduced in Version: 1.1.0

# Class Member Details

## • Matrix2D ([elements]) | Constructor

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

## • Matrix2D clone()

Creates a copy of this object and returns it.

## • Number determinant()

Calculates the determinant of the matrix and returns it.

## • Array [ Number ] elements

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

## • Boolean equals (other)

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

## • Matrix2D identity() | Chainable

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

## • Matrix2D invert() | Chainable

Inverts this transformation matrix.

## • Matrix2D rotation (angle, [origin], [y]) | Chainable

Modifies the elements of this matrix to repressent the rotation 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).
• origin: Point2D or Number or Array [ Number ] - An optional origin of rotation defined by a Point2D, an Array with 2 values (X and Y), or a number repressenting the X value. | Optional
• y: Number - The Y position to rotate around, when only the X offset is specified in the previous argument. | Optional

## • Matrix2D scaling (scale, [y]) | Chainable

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

## • Matrix2D transform (matrix) | Chainable

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

## • Matrix2D translation (direction, [y]) | Chainable

Modifies the elements of this matrix to repressent the translation specified by the arguments. Caller may want to make it an identity matrix, prior to calling this method.
• direction: Vector2D or Number or Array [ Number ] - A direction of movement defined by a Vector2D, an Array with 2 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