Mat4 Class
Extends ValueType
Representation of 4*4 matrix.
Index
Properties
Methods
mulMultiply the current matrix with another onemulScalarMultiply each element of the matrix by a scalar.subSubtracts the current matrix with another onecloneCopy of the specified matrix to obtaincopyCopy the target matrixidentityThe target of an assignment is the identity matrixtransposeTransposed matrixinvertMatrix inversiondeterminantMatrix determinantmultiplyMatrix MultiplicationtransformWas added in a given transformation matrix transformation on the basis oftranslateAdd new displacement transducer in a matrix transformation on the basis of a givenscaleAdd new scaling transformation in a given matrix transformation on the basis ofrotateAdd a new rotational transform matrix transformation on the basis of a givenrotateXAdd rotational transformation around the X axis at a given matrix transformation on the basis ofrotateYAdd about the Y axis rotation transformation in a given matrix transformation on the basis ofrotateZAdded about the Z axis at a given rotational transformation matrix transformation on the basis offromTranslationDisplacement matrix calculationfromScalingScaling matrix calculationfromRotationCalculates the rotation matrixfromXRotationCalculating rotation matrix about the X axisfromYRotationCalculating rotation matrix about the Y axisfromZRotationCalculating rotation matrix about the Z axisfromRTThe rotation and displacement information calculating matrixgetTranslationExtracting displacement information of the matrix, the matrix transform to the default sequential application S-> R-> T isgetScalingScaling information extraction matrix, the matrix transform to the default sequential application S-> R-> T isgetRotationRotation information extraction matrix, the matrix containing no default input scaling information, such as the use oftoRTSshould consider the scaling function.toRTSExtracting rotational displacement, zoom information, the default matrix transformation in order S-> R-> T applicationsfromRTSThe rotary displacement, the scaling matrix calculation information, the order S-> R-> T applicationsfromRTSOriginAccording to the specified rotation, displacement, and scale conversion matrix calculation information center, order S-> R-> T applicationsfromQuatThe rotation matrix calculation information specifiedfrustumThe matrix calculation information specified frustumperspectivePerspective projection matrix calculationorthoComputing orthogonal projection matrixlookAtUpparallel vector or vector centernot be zero - the matrix calculation according to the viewpoint, noteeyeinverseTransposeReversal matrix calculationaddElement by element matrix additionsubtractMatrix element by element subtractionmultiplyScalarMatrix scalar multiplicationmultiplyScalarAndAddElements of the matrix by the scalar multiplication and addition: A + B * scalestrictEqualsAnalyzing the equivalent matrixequalsNegative floating point error is approximately equivalent to determining a matrixtoArrayMatrix transpose arrayfromArrayTransfer matrix arrayconstructorConstructorcloneclone a Mat4 objectsetSets the matrix with another one's valueequalsCheck whether two matrix equalfuzzyEqualsCheck whether two matrix equal with default degree of variance.toStringTransform to string with matrix informationsidentitySet the matrix to the identity matrixtransposeTranspose the values of a mat4invertInverts a mat4adjointCalculates the adjugate of a mat4determinantCalculates the determinant of a mat4addAdds two Mat4subtractSubtracts the current matrix with another onemultiplySubtracts the current matrix with another onemultiplyScalarMultiply each element of the matrix by a scalar.translateTranslate a mat4 by the given vectorscaleScales the mat4 by the dimensions in the given vec3rotateRotates a mat4 by the given angle around the given axisgetTranslationReturns the translation vector component of a transformation matrix.getScaleReturns the scale factor component of a transformation matrixgetRotationReturns the rotation factor component of a transformation matrixfromRTSRestore the matrix values from a quaternion rotation, vector translation and vector scalefromQuatRestore the matrix values from a quaternion rotationlerpLinearly interpolates between this value to to value by ratio which is in the range [0, 1].
Details
Properties
IDENTITY
Identity of Mat4
| meta | description |
|---|---|
| Type | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:86 |
m
Matrix Data
| meta | description |
|---|---|
| Type | Float64Array | Float32Array |
| Defined in | cocos2d/core/value-types/mat4.ts:1641 |
Methods
mul
Multiply the current matrix with another one
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:52 |
Parameters
otherMat4 the second operandoutMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
mulScalar
Multiply each element of the matrix by a scalar.
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:63 |
Parameters
numberNumber amount to scale the matrix's elements byoutMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
sub
Subtracts the current matrix with another one
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:74 |
Parameters
otherMat4 the second operandoutMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
clone
Copy of the specified matrix to obtain
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:93 |
copy
Copy the target matrix
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:111 |
identity
The target of an assignment is the identity matrix
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:160 |
transpose
Transposed matrix
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:189 |
invert
Matrix inversion
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:235 |
determinant
Matrix determinant
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:290 |
multiply
Matrix Multiplication
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:322 |
transform
Was added in a given transformation matrix transformation on the basis of
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:364 |
translate
Add new displacement transducer in a matrix transformation on the basis of a given
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:398 |
scale
Add new scaling transformation in a given matrix transformation on the basis of
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:424 |
rotate
Add a new rotational transform matrix transformation on the basis of a given
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:454 |
Parameters
radUnknown 旋转角度axisUnknown 旋转轴
rotateX
Add rotational transformation around the X axis at a given matrix transformation on the basis of
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:518 |
Parameters
radUnknown 旋转角度
rotateY
Add about the Y axis rotation transformation in a given matrix transformation on the basis of
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:564 |
Parameters
radUnknown 旋转角度
rotateZ
Added about the Z axis at a given rotational transformation matrix transformation on the basis of
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:610 |
Parameters
radUnknown 旋转角度
fromTranslation
Displacement matrix calculation
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:658 |
fromScaling
Scaling matrix calculation
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:687 |
fromRotation
Calculates the rotation matrix
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:716 |
fromXRotation
Calculating rotation matrix about the X axis
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:762 |
fromYRotation
Calculating rotation matrix about the Y axis
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:794 |
fromZRotation
Calculating rotation matrix about the Z axis
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:826 |
fromRT
The rotation and displacement information calculating matrix
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:858 |
getTranslation
Extracting displacement information of the matrix, the matrix transform to the default sequential application S-> R-> T is
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:903 |
getScaling
Scaling information extraction matrix, the matrix transform to the default sequential application S-> R-> T is
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:920 |
getRotation
Rotation information extraction matrix, the matrix containing no default input scaling information, such as the use of toRTS should consider the scaling function.
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:948 |
toRTS
Extracting rotational displacement, zoom information, the default matrix transformation in order S-> R-> T applications
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:990 |
fromRTS
The rotary displacement, the scaling matrix calculation information, the order S-> R-> T applications
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1019 |
fromRTSOrigin
According to the specified rotation, displacement, and scale conversion matrix calculation information center, order S-> R-> T applications
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1067 |
Parameters
qUnknown 旋转值vUnknown 位移值sUnknown 缩放值oUnknown 指定变换中心
fromQuat
The rotation matrix calculation information specified
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1124 |
frustum
The matrix calculation information specified frustum
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1172 |
Parameters
leftUnknown 左平面距离rightUnknown 右平面距离bottomUnknown 下平面距离topUnknown 上平面距离nearUnknown 近平面距离farUnknown 远平面距离
perspective
Perspective projection matrix calculation
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1211 |
Parameters
fovyUnknown 纵向视角高度aspectUnknown 长宽比nearUnknown 近平面距离farUnknown 远平面距离
ortho
Computing orthogonal projection matrix
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1247 |
Parameters
leftUnknown 左平面距离rightUnknown 右平面距离bottomUnknown 下平面距离topUnknown 上平面距离nearUnknown 近平面距离farUnknown 远平面距离
lookAt
Up parallel vector or vector centernot be zero - the matrix calculation according to the viewpoint, note eye
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1285 |
Parameters
eyeUnknown 当前位置centerUnknown 目标视点upUnknown 视口上方向
inverseTranspose
Reversal matrix calculation
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1349 |
add
Element by element matrix addition
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1410 |
subtract
Matrix element by element subtraction
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1439 |
multiplyScalar
Matrix scalar multiplication
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1468 |
multiplyScalarAndAdd
Elements of the matrix by the scalar multiplication and addition: A + B * scale
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1497 |
strictEquals
Analyzing the equivalent matrix
| meta | description |
|---|---|
| Returns | Bool |
| Defined in | cocos2d/core/value-types/mat4.ts:1526 |
equals
Negative floating point error is approximately equivalent to determining a matrix
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1543 |
toArray
Matrix transpose array
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1607 |
Parameters
ofsUnknown 数组内的起始偏移量
fromArray
Transfer matrix array
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1624 |
Parameters
ofsUnknown 数组起始偏移量
constructor
Constructor see cc.mat4
| meta | description |
|---|---|
| Defined in | cocos2d/core/value-types/mat4.ts:1649 |
clone
clone a Mat4 object
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1689 |
set
Sets the matrix with another one's value
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1705 |
Parameters
srcObjMat4
equals
Check whether two matrix equal
| meta | description |
|---|---|
| Returns | Boolean |
| Defined in | cocos2d/core/value-types/mat4.ts:1735 |
Parameters
otherMat4
fuzzyEquals
Check whether two matrix equal with default degree of variance.
| meta | description |
|---|---|
| Returns | Boolean |
| Defined in | cocos2d/core/value-types/mat4.ts:1746 |
Parameters
otherMat4
toString
Transform to string with matrix informations
| meta | description |
|---|---|
| Returns | string |
| Defined in | cocos2d/core/value-types/mat4.ts:1759 |
identity
Set the matrix to the identity matrix
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1784 |
transpose
Transpose the values of a mat4
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1794 |
Parameters
outMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
invert
Inverts a mat4
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1805 |
Parameters
outMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
adjoint
Calculates the adjugate of a mat4
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1816 |
Parameters
outMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
determinant
Calculates the determinant of a mat4
| meta | description |
|---|---|
| Returns | Number |
| Defined in | cocos2d/core/value-types/mat4.ts:1827 |
add
Adds two Mat4
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1836 |
Parameters
otherMat4 the second operandoutMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created.
subtract
Subtracts the current matrix with another one
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1848 |
Parameters
otherMat4 the second operand
multiply
Subtracts the current matrix with another one
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1858 |
Parameters
otherMat4 the second operand
multiplyScalar
Multiply each element of the matrix by a scalar.
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1868 |
Parameters
numberNumber amount to scale the matrix's elements by
translate
Translate a mat4 by the given vector
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1878 |
Parameters
vVec3 vector to translate byoutMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
scale
Scales the mat4 by the dimensions in the given vec3
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1890 |
Parameters
vVec3 vector to scale byoutMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
rotate
Rotates a mat4 by the given angle around the given axis
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1902 |
Parameters
radNumber the angle to rotate the matrix byaxisVec3 the axis to rotate aroundoutMat4 the receiving matrix, you can pass the same matrix to save result to itself, if not provided, a new matrix will be created
getTranslation
Returns the translation vector component of a transformation matrix.
| meta | description |
|---|---|
| Returns | Vec3 |
| Defined in | cocos2d/core/value-types/mat4.ts:1915 |
Parameters
outVec3 Vector to receive translation component, if not provided, a new vec3 will be created
getScale
Returns the scale factor component of a transformation matrix
| meta | description |
|---|---|
| Returns | Vec3 |
| Defined in | cocos2d/core/value-types/mat4.ts:1926 |
Parameters
outVec3 Vector to receive scale component, if not provided, a new vec3 will be created
getRotation
Returns the rotation factor component of a transformation matrix
| meta | description |
|---|---|
| Returns | Quat |
| Defined in | cocos2d/core/value-types/mat4.ts:1937 |
Parameters
outQuat Vector to receive rotation component, if not provided, a new quaternion object will be created
fromRTS
Restore the matrix values from a quaternion rotation, vector translation and vector scale
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1948 |
Parameters
fromQuat
Restore the matrix values from a quaternion rotation
| meta | description |
|---|---|
| Returns | Mat4 |
| Defined in | cocos2d/core/value-types/mat4.ts:1961 |
Parameters
qQuat Rotation quaternion
lerp
Linearly interpolates between this value to to value by ratio which is in the range [0, 1]. When ratio = 0 returns this. When ratio = 1 return to. When ratio = 0.5 returns the average of this and to.
| meta | description |
|---|---|
| Returns | ValueType |
| Defined in | cocos2d/core/value-types/value-type.ts:63 |