Class: Matrix

CoreControls.Math. Matrix

A utility class that represents transformations and transformation states.

new Matrix(Rows, Columns)

Creates a new Matrix.
Parameters:
Name Type Description
Rows number the number of rows
Columns number the number of columns
Properties:
Name Type Description
Rows number the number of rows
Columns number the number of columns

Members


<static> Identity

Returns a 3x3 identity matrix.

Methods


<static> createTransformWithRespectTo(transforms [, origin])

Multiples a series of transformations to create a final transformation matrix. Optionally, provide a point to transform with respect to. Note that the order of transformations in the array matters and should be the logical order you expect them to execute in.
Parameters:
Name Type Argument Description
transforms Array.<CoreControls.Math.Matrix> An array of ordered transformations
origin CoreControls.Math.Point <optional>
A point to transform with respect to. Default: (0, 0)
Returns:
The result matrix
Type
CoreControls.Math.Matrix

<static> fromMatrix2D(mat2d)

Creates a matrix from Matrix2D.
Parameters:
Name Type Description
mat2d PDFNet.Matrix2D The PDFNet matrix
Returns:
The matrix that represents the original
Type
CoreControls.Math.Matrix

<static> multiply(left, right)

Multiplies two matrices together
Parameters:
Name Type Description
left CoreControls.Math.Matrix The left matrix
right CoreControls.Math.Matrix The right Matrix
Returns:
The result matrix
Type
CoreControls.Math.Matrix

clone()

Clones this matrix.
Returns:
A clone of this matrix

determinent()

Calculates the determinant of the matrix. Only works for 3x3!
Returns:
The determinant
Type
number

get(row, column)

Gets a value in a particular cell in the matrix.
Parameters:
Name Type Description
row number The row number
column number The column number
Returns:
Type
number

inverse()

Get an inverse matrix. This is helpful for reversing transformations.
Returns:
The inverse matrix of this matrix
Type
CoreControls.Math.Matrix

multiply(rightMatrix)

Multiples this matrix (left) against another matrix (right).
Parameters:
Name Type Description
rightMatrix CoreControls.Math.Matrix The other matrix
Returns:
The result matrix
Type
CoreControls.Math.Matrix

set(row, column, val)

Sets the value in a particular cell in the matrix.
Parameters:
Name Type Description
row number The row number
column number The column number
val number The number to set

setRotation(angle [, inRadians])

Sets the rotational values of the matrix.
Parameters:
Name Type Argument Default Description
angle number The amount to rotate by.
inRadians boolean <optional>
false Whether the amount is in radians. Default: false

setScale(sx, sy)

Sets the scale transformation values.
Parameters:
Name Type Description
sx number The amount to scale horizontally
sy number The amount to scale vertically

setScaleX(sx)

Set the X scale transformation value.
Parameters:
Name Type Description
sx The amount to scale horizontally

setScaleY(sy)

Set the Y scale transformation value.
Parameters:
Name Type Description
sy The amount to scale vertically

setSkew(sx, sy)

Sets the skew transformation values.
Parameters:
Name Type Description
sx The amount to skew horizontally
sy The amount to skew vertically

setSkewX(sx)

Sets the X skew transformation value.
Parameters:
Name Type Description
sx The amount to skew horizontally.

setSkewY(sy)

Sets the Y skew transformation value.
Parameters:
Name Type Description
sy The amount to skew vertically.

setTranslate(tx, ty)

Sets the translate transformation values.
Parameters:
Name Type Description
tx The amount to translate horizontally
ty The amount to translate vertically

setTranslateX(tx)

Sets the X translate transformation value.
Parameters:
Name Type Description
tx The amount to translate horizontally

setTranslateY(ty)

Set the Y translate transformation value.
Parameters:
Name Type Description
ty The amount to translate vertically

toTransform()

Gets an array of values to use in an HTML Canvas context transform.
Returns:
Array of values
Type
Array.<number>

transpose()

Flips the values of the matrix using the diagonal row.