Class: Matrix4Notifier

Matrix4Notifier

new Matrix4Notifier()

4x4 矩阵,具有 onUpdate 回调

Extends

Members Show Inherited

Name Type Default Description
className String Matrix4Notifier

类名

isMatrix4Notifier Boolean true
elements Float32Array

数据

isMatrix4 Boolean true inherited

Methods Show Inherited

更新的回调

Copy the values from one mat4 to this

Name Type Description
m Matrix4

the source matrix

Returns:
Type Description
Matrix4Notifier this

fromArray(array, offset){Matrix4Notifier}

从数组赋值

Name Type Default Description
array Array.<number> | TypedArray

数组

offset Number 0 optional

数组偏移值

Returns:
Type Description
Matrix4Notifier this

set(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33){Matrix4Notifier}

Set the components of a mat3 to the given values

Name Type Description
m00 Number
m01 Number
m02 Number
m03 Number
m10 Number
m11 Number
m12 Number
m13 Number
m20 Number
m21 Number
m22 Number
m23 Number
m30 Number
m31 Number
m32 Number
m33 Number
Returns:
Type Description
Matrix4Notifier this

Set this to the identity matrix

Returns:
Type Description
Matrix4Notifier this

Transpose the values of this

Returns:
Type Description
Matrix4Notifier this

invert a matrix

Name Type Default Description
m Matrix4 this optional
Returns:
Type Description
Matrix4Notifier this

Calculates the adjugate of a mat4

Name Type Default Description
m Matrix4 this optional
Returns:
Type Description
Matrix4Notifier this

Calculates the determinant of this

Returns:
Type Description
Matrix4Notifier this

Multiplies two matrix4's

Name Type Description
a Matrix4
b Matrix4 optional

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

Returns:
Type Description
Matrix4Notifier this

左乘

Name Type Description
m Matrix4
Returns:
Type Description
Matrix4Notifier this

Translate this by the given vector

Name Type Description
v Vector3

vector to translate by

Returns:
Type Description
Matrix4Notifier this

Scales the mat3 by the dimensions in the given vec2

Name Type Description
v Vector3

the vec3 to scale the matrix by

Returns:
Type Description
Matrix4Notifier this

Rotates this by the given angle

Name Type Description
rad Number

the angle to rotate the matrix by

axis Vector3

the axis to rotate around

Returns:
Type Description
Matrix4Notifier this

Rotates this by the given angle around the X axis

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix4Notifier this

Rotates this by the given angle around the Y axis

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix4Notifier this

Rotates this by the given angle around the Z axis

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix4Notifier this

fromTranslation(transition){Matrix4Notifier}

Creates a matrix from a vector translation

Name Type Description
transition Vector3

Translation vector

Returns:
Type Description
Matrix4Notifier this

Creates a matrix from a vector scaling

Name Type Description
v Vector3

Scaling vector

Returns:
Type Description
Matrix4Notifier this

Creates a matrix from a given angle around a given axis

Name Type Description
rad Number

the angle to rotate the matrix by

axis Vector3

the axis to rotate around

Returns:
Type Description
Matrix4Notifier this

Creates a matrix from the given angle around the X axis

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix4Notifier this

Creates a matrix from the given angle around the Y axis

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix4Notifier this

Creates a matrix from the given angle around the Z axis

Name Type Description
rad Number

the angle to rotate the matrix by

Returns:
Type Description
Matrix4Notifier this

fromRotationTranslation(q, v){Matrix4Notifier}

Creates a matrix from a quaternion rotation and vector translation

Name Type Description
q Quaternion

Rotation quaternion

v Vector3

Translation vector

Returns:
Type Description
Matrix4Notifier this

getTranslation(out){Vector3}

Returns the translation vector component of a transformation matrix. If a matrix is built with fromRotationTranslation, the returned vector will be the same as the translation vector originally supplied.

Name Type Default Description
out Vector3 new Vector3 optional

Vector to receive translation component

Returns:
Type Description
Vector3 out

Returns the scaling factor component of a transformation matrix. If a matrix is built with fromRotationTranslationScale with a normalized Quaternion paramter, the returned vector will be the same as the scaling vector originally supplied.

Name Type Default Description
out Vector3 new Vector3 optional

Vector to receive scaling factor component

Returns:
Type Description
Vector3 out

Returns a quaternion representing the rotational component of a transformation matrix. If a matrix is built with fromRotationTranslation, the returned quaternion will be the same as the quaternion originally supplied.

Name Type Description
out Quaternion

Quaternion to receive the rotation component

Returns:
Type Description
Quaternion out

fromRotationTranslationScale(q, v, s){Matrix4Notifier}

Creates a matrix from a quaternion rotation, vector translation and vector scale

Name Type Description
q Quaternion

Rotation quaternion

v Vector3

Translation vector

s Vector3

Scaling vector

Returns:
Type Description
Matrix4Notifier this

fromRotationTranslationScaleOrigin(q, v, s, o, notCallUpdate){Matrix4Notifier}

Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin

Name Type Default Description
q Quaternion

Rotation quaternion

v Vector3

Translation vector

s Vector3

Scaling vector

o Vector3

The origin vector around which to scale and rotate

notCallUpdate Boolean false optional

notCallUpdate

Returns:
Type Description
Matrix4Notifier this

Calculates a 4x4 matrix from the given quaternion

Name Type Description
q Quaternion

Quaternion to create matrix from

Returns:
Type Description
Matrix4Notifier this

frustum(left, right, bottom, top, near, far){Matrix4Notifier}

Generates a frustum matrix with the given bounds

Name Type Description
left Number

Left bound of the frustum

right Number

Right bound of the frustum

bottom Number

Bottom bound of the frustum

top Number

Top bound of the frustum

near Number

Near bound of the frustum

far Number

Far bound of the frustum

Returns:
Type Description
Matrix4Notifier this

perspective(fovy, aspect, near, far){Matrix4Notifier}

Generates a perspective projection matrix with the given bounds

Name Type Description
fovy Number

Vertical field of view in radians

aspect Number

Aspect ratio. typically viewport width/height

near Number

Near bound of the frustum

far Number

Far bound of the frustum

Returns:
Type Description
Matrix4Notifier this

perspectiveFromFieldOfView(fov, Near, far){Matrix4Notifier}

Generates a perspective projection matrix with the given field of view.

Name Type Description
fov Object

Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees

Near Number

bound of the frustum

far Number

Far bound of the frustum

Returns:
Type Description
Matrix4Notifier this

ortho(left, right, bottom, top, near, far){Matrix4Notifier}

Generates a orthogonal projection matrix with the given bounds

Name Type Description
left Number

Left bound of the frustum

right Number

Right bound of the frustum

bottom Number

Bottom bound of the frustum

top Number

Top bound of the frustum

near Number

Near bound of the frustum

far Number

Far bound of the frustum

Returns:
Type Description
Matrix4Notifier this

Generates a look-at matrix with the given eye position, focal point, and up axis

Name Type Description
eye XYZObject

Position of the viewer

center XYZObject

Point the viewer is looking at

up Vector3

pointing up

Returns:
Type Description
Matrix4Notifier this

targetTo(eye, Point, up){Matrix4Notifier}

Generates a matrix that makes something look at something else.

Name Type Description
eye XYZObject

Position of the viewer

Point XYZObject

the viewer is looking at

up Vector3

pointing up

Returns:
Type Description
Matrix4Notifier this

Returns Frobenius norm of a mat4

Returns:
Type Description
Number Frobenius norm

Adds two mat4's

Name Type Description
a Matrix4
b Matrix4 optional

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

Returns:
Type Description
Matrix4 this

Subtracts matrix b from matrix a

Name Type Description
a Matrix4
b Matrix4 optional

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

Returns:
Type Description
Matrix4 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 Matrix4
b Matrix4 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 Matrix4
b Matrix4 optional

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

Returns:
Type Description
Boolean

compose

Name Type Description
q Quaternion

quaternion

v Vector3

position

s Vector3

scale

p Vector3

[pivot]

Returns:
Type Description
Matrix4Notifier this

decompose

Name Type Description
q Quaternion

quaternion

v Vector3

position

s Vector3

scale

p Vector3

[pivot]

Returns:
Type Description
Matrix4Notifier this

Creates a new mat4 initialized with values from this matrix

Returns:
Type Description
Matrix4 a new Matrix4

inherited toArray(array, offset){Array}

转换到数组

Name Type Default Description
array Array.<number> | TypedArray [] optional

数组

offset Number 0 optional

数组偏移值

Returns:
Type Description
Array

Alias for Matrix4#subtract

Alias for Matrix4#multiply