Edit in GitHubLog an issue

Matrix3D

Kind: class

new Matrix3D()#

new Matrix3D(a, b, c, d, e, f, m20, m21, m02, m12, m22, z): Matrix3D

Creates a new 3D transform matrix with the following structure:

Copied to your clipboard
1| a c m02 e |
2| b d m12 f |
3| m20 m21 m22 mz |
4| 0 0 0 1 |

newFrom()#

newFrom(m): Matrix3D

Create a new Matrix3D object starting from the given Matrix2D or Matrix3D parameter.

ParamTypeDescription
mMatrix | Matrix3DThe matrix to clone.

Kind: instance method of Matrix3D

setFrom()#

setFrom(otherMatrix)

Copies another matrix's values into this matrix.

ParamTypeDescription
otherMatrixMatrix | Matrix3DThe matrix to copy values from.

Kind: instance method of Matrix3D

clone()#

clone(): Matrix3D

Clone the matrix

Kind: instance method of Matrix3D

add()#

add(m1, m2): Matrix | Matrix3D

Safely add a mixture of Matrix and Matrix3D without dropping the 3D part.

Returns the addition result which is Matrix if both were Matrix, and Matrix3D otherwise.

ParamTypeDescription
m1Matrix | Matrix3DThe first matrix.
m2Matrix | Matrix3DThe second matrix.

Kind: instance method of Matrix3D

clear3D()#

clear3D()

Clears the 3D components of this matrix. Functionally equivalent to converting to a 2D matrix and then back to a 3D one.

Kind: instance method of Matrix3D

strictHas3D()#

strictHas3D(): boolean

Returns true if we have 3D components in this matrix.

Check if this matrix has 3D components. An efficient of checking if new Matrix3D().setFrom(this.toMatrix()) !== this

Kind: instance method of Matrix3D

has3D()#

has3D(): boolean

Check if this matrix has 3D components, with an epsilon. Returns true if we have 3D components in this matrix.

Kind: instance method of Matrix3D

set6()#

set6(a, b, c, d, e, f)

Set the 2D components of this matrix and clear the 3D ones.

Kind: instance method of Matrix3D

setIdentity()#

setIdentity()

Set the identity matrix.

Kind: instance method of Matrix3D

isIdentity()#

isIdentity(): boolean

Check if the matrix is the identity matrix. Returns true if the matrix is the identity matrix.

Kind: instance method of Matrix3D

isInvertible()#

isInvertible(): boolean

Test if this matrix is invertible. Returns true if we can invert this matrix.

Kind: instance method of Matrix3D

invert()#

invert(): Matrix3D

Return the inverse of this matrix. The original matrix is not modified.

Kind: instance method of Matrix3D

setConcat()#

setConcat(a, b): Matrix3D

Set this matrix to the concatenation of A * B.

ParamType
aMatrix3D
bMatrix3D

Kind: instance method of Matrix3D

multRight()#

multRight(a, b, c, d, e, f): Matrix3D

Multiplies a passed affine transform to the right: this * M.

ParamTypeDescription
aMatrix | Matrix3DA Matrix or the a component of a affine transform.
b?numberThe b component of a affine transform.
c?numberThe c component of a affine transform.
d?numberThe d component of a affine transform.
e?numberThe e component of a affine transform.
f?numberThe f component of a affine transform.

Kind: instance method of Matrix3D

multLeft()#

multLeft(a, b, c, d, e, f): Matrix3D

Multiplies a passed affine transform to the left: this * M.

ParamTypeDescription
aMatrix | Matrix3DA Matrix or the a component of a affine transform.
b?numberThe b component of a affine transform.
c?numberThe c component of a affine transform.
d?numberThe d component of a affine transform.
e?numberThe e component of a affine transform.
f?numberThe f component of a affine transform.

Kind: instance method of Matrix3D

translate()#

translate(tx, ty, tz): Matrix3D

Translate the matrix

ParamTypeDescription
txnumbertranslate on X axis
tynumbertranslate on y axis
tznumbertranslate on z axis

Kind: instance method of Matrix3D

translateLeft()#

translateLeft(tx, ty, tz): Matrix3D

Translate the matrix, but in global coordinates. Mathematically, this is the same thing as adding the delta directly to the translation column (last column) of the matrix.

ParamType
txnumber
tynumber
tznumber

Kind: instance method of Matrix3D

translateWithPoint()#

translateWithPoint(point): Matrix3D

Translate with Point. Returns the modified matrix.

ParamTypeDescription
point{x: number, y: number} | {x: number, y: number, z: number}the point reprezenting horizontal and vertical translation (and optionally z translation as well).

Kind: instance method of Matrix3D

getTranslate()#

getTranslate(): Array

Get the translate component of this matrix, as an array.

Kind: instance method of Matrix3D

scale()#

scale(scale, sy, sz): Matrix3D

Scale the matrix

ParamTypeDescription
scalenumberThe scale value on X axis
sy?numberThe scale value on Y axis; if undefined, the scale value will be used
sz?numberThe scale value on Z axis; if undefined, the matrix will not be scaled on Z

Kind: instance method of Matrix3D

rotate()#

rotate(a, x, y): Matrix3D

Rotate the matrix around the Z axis (optionally, around a point).

ParamTypeDescription
anumberAngle in degrees
x?numberThe x coordinate of the point used as center of rotation.
y?numberThe y coordinate of the point used as center of rotation.

Kind: instance method of Matrix3D

rotateX()#

rotateX(a): Matrix3D

Rotate the matrix around the X axis.

ParamTypeDescription
anumberAngle in degrees

Kind: instance method of Matrix3D

rotateY()#

rotateY(a): Matrix3D

Rotate the matrix around the Y axis.

ParamTypeDescription
anumberAngle in degrees

Kind: instance method of Matrix3D

x()#

x(x, y, z): number

Returns the x coordinate for a given point after transformation described by the matrix.

See: Matrix3D.y, Matrix3D.z

ParamTypeDescription
xnumberThe x coordinate of the given point
ynumberThe y coordinate of the given point
z?numberThe z coordinate of the given point

Kind: instance method of Matrix3D

y()#

y(x, y, z): number

Returns the y coordinate for a given point after transformation described by the matrix.

See: Matrix3D.x, Matrix3D.z

ParamTypeDescription
xnumberThe x coordinate of the given point
ynumberThe y coordinate of the given point
z?numberThe z coordinate of the given point

Kind: instance method of Matrix3D

z()#

z(x, y, z): number

Returns the z coordinate for a given point after transformation described by the matrix.

See: Matrix3D.x, Matrix3D.y

ParamTypeDescription
xnumberThe x coordinate of the given point
ynumberThe y coordinate of the given point
z?numberThe z coordinate of the given point

Kind: instance method of Matrix3D

transformPoint()#

transformPoint(point): {x:number, y:number}

Transforms a 2D point using the matrix.

ParamType
point{x:number, y:number}

Kind: instance method of Matrix3D

transformOrigin()#

transformOrigin(): {x:number, y:number}

Transform the point (0, 0).

Kind: instance method of Matrix3D

transformPoint3D()#

transformPoint3D(point): {x:number, y:number, z:number}

Transforms a 3D point using the matrix.

ParamType
point{x:number, y:number, z:number}

Kind: instance method of Matrix3D

transformRect()#

transformRect(rect): {x:number, y:number, width:number, height:number}

Transforms a rectangle using the matrix.

ParamType
rect{x:number, y:number, width:number, height:number}

Kind: instance method of Matrix3D

hasSkew()#

hasSkew(): boolean

Check if the matrix will introduce any skew on the XY plane. Returns true, if the matrix contains skew.

Kind: instance method of 3DMatrix

hasSkewXZ()#

hasSkewXZ(): boolean

Check if the matrix will introduce any skew on the XZ plane. Returns true, if the matrix contains skew.

Kind: instance method of 3DMatrix

hasSkewYZ()#

hasSkewYZ(): boolean

Check if the matrix will introduce any skew on the YZ plane. Returns true, if the matrix contains skew.

Kind: instance method of 3DMatrix

isTranslationOnly()#

isTranslationOnly(): boolean

Returns true if there are no scale, skew, or rotation values, and the matrix is all translation. (Although identity is still considered all translation.) This is equivalent to this.strictEquals(new Matrix3D().translate(...this.getTranslate()))

Kind: instance method of 3DMatrix

getRotation()#

getRotation(): number

Get the rotation of this matrix.

Kind: instance method of 3DMatrix

flip()#

flip(flipInfo, width, height)

Performs a flip to the matrix according to the passed FlipInfo. If the width and height of an object on which the transform matrix would be applied is passed, the required translation is performed to keep the object in place.

ParamTypeDescription
flipInfo{flipX: boolean, flipY: boolean}flipX - Specifies if the object is flipped horizontally, FlipY - Specifies if the object is flipped vertically
width?numberThe width of the node on which the matrix is to be applied
height?numberThe height of the node on which the matrix is to be applied

Kind: instance method of Matrix3D

equals()#

equals(otherMatrix): boolean

Compare a matrix for equality with a tolerance. Returns true if current matrix is identical upto ZERO_TOLERANCE with otherMatrix.

ParamTypeDescription
otherMatrixMatrix3Dthe matrix to compare with.

Kind: instance method of 3DMatrix

strictEquals()#

strictEquals(otherMatrix): boolean

Compare a matrix with strict equality / zero tolerance. Returns true if current matrix is identical.

ParamTypeDescription
otherMatrixMatrix3Dthe matrix to compare with.

Kind: instance method of 3DMatrix

toTransformString()#

toTransformString(): string

Returns transform string that represents given matrix.

Kind: instance method of 3DMatrix

roundToSinglePrecision()#

roundToSinglePrecision(): Matrix3D

Rounds all the values held inside the matrix to single point precision and return the matrix.

Kind: instance method of Matrix3D

Was this helpful?
Copyright © 2021 Adobe. All rights reserved.