Class: Matrix3

Matrix3

new Matrix3()

3x3 矩阵

Members Show Inherited

Name Type Default Description
className String Matrix3

类名

isMatrix3 Boolean true
elements Float32Array

数据

Methods Show Inherited

Copy the values from one mat3 to this

Name Type Description
m Matrix3

the source matrix

Returns:
Type Description
Matrix3 this

Creates a new mat3 initialized with values from this matrix

Returns:
Type Description
Matrix3 a new Matrix3

toArray(array, offset){Array}

转换到数组

Name Type Default Description
array Array [] optional

数组

offset Number 0 optional

数组偏移值

Returns:
Type Description
Array

fromArray(array, offset){Matrix3}

从数组赋值

Name Type Default Description
array Array

数组

offset Number 0 optional

数组偏移值

Returns:
Type Description
Matrix3 this

set(m00, m01, m02, m10, m11, m12, m20, m21, m22){Matrix3}

Set the components of a mat3 to the given values

Name Type Description
m00 Number
m01 Number
m02 Number
m10 Number
m11 Number
m12 Number
m20 Number
m21 Number
m22 Number
Returns:
Type Description
Matrix3 this

Set this to the identity matrix

Returns:
Type Description
Matrix3 this

Transpose the values of this

Returns:
Type Description
Matrix3 this

invert a matrix

Name Type Default Description
m Matrix3 this optional
Returns:
Type Description
Matrix3 this

Calculates the adjugate of a mat3

Name Type Default Description
m Matrix3 this optional
Returns:
Type Description
Matrix3 this

determinant(){Number}

Calculates the determinant of this

Returns:
Type Description
Number

multiply(a, b){Matrix3}

Multiplies two matrix3's

Name Type Description
a Matrix3
b Matrix3 optional

如果不传,计算 this 和 a 的乘积

Returns:
Type Description
Matrix3 this

premultiply(m){Matrix3}

左乘

Name Type Description
m Matrix3
Returns:
Type Description
Matrix3 this

Translate this by the given vector

Name Type Description
v Vector2

vector to translate by

Returns:
Type Description
Matrix3 this

Rotates this by the given angle

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix3 this

Scales the mat3 by the dimensions in the given vec2

Name Type Description
v Vector2

the vec2 to scale the matrix by

Returns:
Type Description
Matrix3 this

fromTranslation(v){Matrix3}

Creates a matrix from a vector translation

Name Type Description
v Vector2

Translation vector

Returns:
Type Description
Matrix3 this

fromRotation(rad){Matrix3}

Creates a matrix from a given angle

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix3 this

fromScaling(v){Matrix3}

Creates a matrix from a vector scaling

Name Type Description
v Vector2

Scaling vector

Returns:
Type Description
Matrix3 this

Calculates a 3x3 matrix from the given quaternion

Name Type Description
q Quaternion

Quaternion to create matrix from

Returns:
Type Description
Matrix3 this

normalFromMat4(m){Matrix3}

Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix

Name Type Description
m Matrix4

Mat4 to derive the normal matrix from

Returns:
Type Description
Matrix3 this

Copies the upper-left 3x3 values into the given mat3.

Name Type Description
m Matrix4

the source 4x4 matrix

Returns:
Type Description
Matrix3 this

frob(){Number}

Returns Frobenius norm of this

Returns:
Type Description
Number Frobenius norm

add(a, b){Marix4}

Adds two mat3's

Name Type Description
a Matrix3
b Matrix3 optional

如果不传,计算 this 和 a 的和

Returns:
Type Description
Marix4 this

subtract(a, b){Marix4}

Subtracts matrix b from matrix a

Name Type Description
a Matrix3
b Matrix3 optional

如果不传,计算 this 和 a 的差

Returns:
Type Description
Marix4 this

exactEquals(a, b){Boolean}

Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)

Name Type Description
a Matrix3
b Matrix3 optional

如果不传,比较 this 和 a 是否相等

Returns:
Type Description
Boolean

equals(a, b){Boolean}

Returns whether or not the matrices have approximately the same elements in the same position.

Name Type Description
a Matrix3
b Matrix3 optional

如果不传,比较 this 和 a 是否近似相等

Returns:
Type Description
Boolean

fromRotationTranslationScale(r, x, y, scaleX, scaleY){Matrix3}

fromRotationTranslationScale

Name Type Description
r Number

rad angle

x Number
y Number
scaleX Number
scaleY Number
Returns:
Type Description
Matrix3

Alias for Matrix3#subtract

Alias for Matrix3#multiply