-
new Matrix4()
-
4x4 矩阵
Members Show Inherited
| Name | Type | Default | Description |
|---|---|---|---|
className
|
String | Matrix4 |
类名 |
isMatrix4
|
Boolean | true | |
elements
|
Float32Array |
数据 |
Methods Show Inherited
-
copy(m){Matrix4}
-
Copy the values from one mat4 to this
Name Type Description mMatrix4 the source matrix
Returns:
Type Description Matrix4 this -
clone(){Matrix4}
-
Creates a new mat4 initialized with values from this matrix
Returns:
Type Description Matrix4 a new Matrix4 -
toArray(array, offset){Array}
-
转换到数组
Name Type Default Description arrayArray.<number> | TypedArray [] optional 数组
offsetNumber 0 optional 数组偏移值
Returns:
Type Description Array -
fromArray(array, offset){Matrix4}
-
从数组赋值
Name Type Default Description arrayArray.<number> | TypedArray 数组
offsetNumber 0 optional 数组偏移值
Returns:
Type Description Matrix4 this -
set(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33){Matrix4}
-
Set the components of a mat3 to the given values
Name Type Description m00Number m01Number m02Number m03Number m10Number m11Number m12Number m13Number m20Number m21Number m22Number m23Number m30Number m31Number m32Number m33Number Returns:
Type Description Matrix4 this -
invert(m){Matrix4}
-
invert a matrix
Name Type Default Description mMatrix4 this optional Returns:
Type Description Matrix4 this -
adjoint(m){Matrix4}
-
Calculates the adjugate of a mat4
Name Type Default Description mMatrix4 this optional Returns:
Type Description Matrix4 this -
multiply(a, b){Matrix4}
-
Multiplies two matrix4's
Name Type Description aMatrix4 bMatrix4 optional 如果不传,计算 this 和 a 的乘积
Returns:
Type Description Matrix4 this -
translate(v){Matrix4}
-
Translate this by the given vector
Name Type Description vVector3 vector to translate by
Returns:
Type Description Matrix4 this -
scale(v){Matrix4}
-
Scales the mat3 by the dimensions in the given vec2
Name Type Description vVector3 the vec3 to scale the matrix by
Returns:
Type Description Matrix4 this -
rotate(rad, axis){Matrix4}
-
Rotates this by the given angle
Name Type Description radNumber the angle to rotate the matrix by
axisVector3 the axis to rotate around
Returns:
Type Description Matrix4 this -
rotateX(rad){Matrix4}
-
Rotates this by the given angle around the X axis
Name Type Description radNumber the angle to rotate the matrix by
Returns:
Type Description Matrix4 this -
rotateY(rad){Matrix4}
-
Rotates this by the given angle around the Y axis
Name Type Description radNumber the angle to rotate the matrix by
Returns:
Type Description Matrix4 this -
rotateZ(rad){Matrix4}
-
Rotates this by the given angle around the Z axis
Name Type Description radNumber the angle to rotate the matrix by
Returns:
Type Description Matrix4 this -
fromTranslation(transition){Matrix4}
-
Creates a matrix from a vector translation
Name Type Description transitionVector3 Translation vector
Returns:
Type Description Matrix4 this -
fromScaling(v){Matrix4}
-
Creates a matrix from a vector scaling
Name Type Description vVector3 Scaling vector
Returns:
Type Description Matrix4 this -
fromRotation(rad, axis){Matrix4}
-
Creates a matrix from a given angle around a given axis
Name Type Description radNumber the angle to rotate the matrix by
axisVector3 the axis to rotate around
Returns:
Type Description Matrix4 this -
fromXRotation(rad){Matrix4}
-
Creates a matrix from the given angle around the X axis
Name Type Description radNumber the angle to rotate the matrix by
Returns:
Type Description Matrix4 this -
fromYRotation(rad){Matrix4}
-
Creates a matrix from the given angle around the Y axis
Name Type Description radNumber the angle to rotate the matrix by
Returns:
Type Description Matrix4 this -
fromZRotation(rad){Matrix4}
-
Creates a matrix from the given angle around the Z axis
Name Type Description radNumber the angle to rotate the matrix by
Returns:
Type Description Matrix4 this -
fromRotationTranslation(q, v){Matrix4}
-
Creates a matrix from a quaternion rotation and vector translation
Name Type Description qQuaternion Rotation quaternion
vVector3 Translation vector
Returns:
Type Description Matrix4 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 outVector3 new Vector3 optional Vector to receive translation component
Returns:
Type Description Vector3 out -
getScaling(out){Vector3}
-
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 outVector3 new Vector3 optional Vector to receive scaling factor component
Returns:
Type Description Vector3 out -
getRotation(out){Quaternion}
-
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 Default Description outQuaternion new Quaternion optional Quaternion to receive the rotation component
Returns:
Type Description Quaternion out -
fromRotationTranslationScale(q, v, s){Matrix4}
-
Creates a matrix from a quaternion rotation, vector translation and vector scale
Name Type Description qQuaternion Rotation quaternion
vVector3 Translation vector
sVector3 Scaling vector
Returns:
Type Description Matrix4 this -
fromRotationTranslationScaleOrigin(q, v, s, o){Matrix4}
-
Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
Name Type Description qQuaternion Rotation quaternion
vVector3 Translation vector
sVector3 Scaling vector
oVector3 The origin vector around which to scale and rotate
Returns:
Type Description Matrix4 this -
fromQuat(q){Matrix4}
-
Calculates a 4x4 matrix from the given quaternion
Name Type Description qQuaternion Quaternion to create matrix from
Returns:
Type Description Matrix4 this -
frustum(left, right, bottom, top, near, far){Matrix4}
-
Generates a frustum matrix with the given bounds
Name Type Description leftNumber Left bound of the frustum
rightNumber Right bound of the frustum
bottomNumber Bottom bound of the frustum
topNumber Top bound of the frustum
nearNumber Near bound of the frustum
farNumber Far bound of the frustum
Returns:
Type Description Matrix4 this -
perspective(fovy, aspect, near, far){Matrix4}
-
Generates a perspective projection matrix with the given bounds
Name Type Description fovyNumber Vertical field of view in radians
aspectNumber Aspect ratio. typically viewport width/height
nearNumber Near bound of the frustum
farNumber Far bound of the frustum
Returns:
Type Description Matrix4 this -
perspectiveFromFieldOfView(fov, Near, far){Matrix4}
-
Generates a perspective projection matrix with the given field of view.
Name Type Description fovObject Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
NearNumber bound of the frustum
farNumber Far bound of the frustum
Returns:
Type Description Matrix4 this -
ortho(left, right, bottom, top, near, far){Matrix4}
-
Generates a orthogonal projection matrix with the given bounds
Name Type Description leftNumber Left bound of the frustum
rightNumber Right bound of the frustum
bottomNumber Bottom bound of the frustum
topNumber Top bound of the frustum
nearNumber Near bound of the frustum
farNumber Far bound of the frustum
Returns:
Type Description Matrix4 this -
lookAt(eye, center, up){Matrix4}
-
Generates a look-at matrix with the given eye position, focal point, and up axis
Name Type Description eyeXYZObject Position of the viewer
centerXYZObject Point the viewer is looking at
upVector3 pointing up
Returns:
Type Description Matrix4 this -
targetTo(eye, Point, up){Matrix4}
-
Generates a matrix that makes something look at something else.
Name Type Description eyeXYZObject Position of the viewer
PointXYZObject the viewer is looking at
upVector3 pointing up
Returns:
Type Description Matrix4 this -
frob(){Number}
-
Returns Frobenius norm of a mat4
Returns:
Type Description Number Frobenius norm -
add(a, b){Matrix4}
-
Adds two mat4's
Name Type Description aMatrix4 bMatrix4 optional 如果不传,计算 this 和 a 的和
Returns:
Type Description Matrix4 this -
subtract(a, b){Matrix4}
-
Subtracts matrix b from matrix a
Name Type Description aMatrix4 bMatrix4 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 aMatrix4 bMatrix4 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 aMatrix4 bMatrix4 optional 如果不传,比较 this 和 a 是否近似相等
Returns:
Type Description Boolean -
compose(q, v, s, p){Matrix4}
-
compose
Name Type Description qQuaternion quaternion
vVector3 position
sVector3 scale
pVector3 optional pivot
Returns:
Type Description Matrix4 this -
decompose(q, v, s, p){Matrix4}
-
decompose
Name Type Description qQuaternion quaternion
vVector3 position
sVector3 scale
pVector3 [pivot]
Returns:
Type Description Matrix4 this -
sub()
-
Alias for
Matrix4#subtract -
mul()
-
Alias for
Matrix4#multiply