Mat4
Class
Extends ValueType
Representation of 4*4 matrix.
Index
Properties
Methods
mul
Multiply the current matrix with another onemulScalar
Multiply each element of the matrix by a scalar.sub
Subtracts the current matrix with another oneclone
Copy of the specified matrix to obtaincopy
Copy the target matrixidentity
The target of an assignment is the identity matrixtranspose
Transposed matrixinvert
Matrix inversiondeterminant
Matrix determinantmultiply
Matrix Multiplicationtransform
Was added in a given transformation matrix transformation on the basis oftranslate
Add new displacement transducer in a matrix transformation on the basis of a givenscale
Add new scaling transformation in a given matrix transformation on the basis ofrotate
Add a new rotational transform matrix transformation on the basis of a givenrotateX
Add rotational transformation around the X axis at a given matrix transformation on the basis ofrotateY
Add about the Y axis rotation transformation in a given matrix transformation on the basis ofrotateZ
Added about the Z axis at a given rotational transformation matrix transformation on the basis offromTranslation
Displacement matrix calculationfromScaling
Scaling matrix calculationfromRotation
Calculates the rotation matrixfromXRotation
Calculating rotation matrix about the X axisfromYRotation
Calculating rotation matrix about the Y axisfromZRotation
Calculating rotation matrix about the Z axisfromRT
The rotation and displacement information calculating matrixgetTranslation
Extracting displacement information of the matrix, the matrix transform to the default sequential application S-> R-> T isgetScaling
Scaling information extraction matrix, the matrix transform to the default sequential application S-> R-> T isgetRotation
Rotation information extraction matrix, the matrix containing no default input scaling information, such as the use oftoRTS
should consider the scaling function.toRTS
Extracting rotational displacement, zoom information, the default matrix transformation in order S-> R-> T applicationsfromRTS
The rotary displacement, the scaling matrix calculation information, the order S-> R-> T applicationsfromRTSOrigin
According to the specified rotation, displacement, and scale conversion matrix calculation information center, order S-> R-> T applicationsfromQuat
The rotation matrix calculation information specifiedfrustum
The matrix calculation information specified frustumperspective
Perspective projection matrix calculationortho
Computing orthogonal projection matrixlookAt
Up
parallel vector or vector centernot be zero - the matrix calculation according to the viewpoint, note
eyeinverseTranspose
Reversal matrix calculationadd
Element by element matrix additionsubtract
Matrix element by element subtractionmultiplyScalar
Matrix scalar multiplicationmultiplyScalarAndAdd
Elements of the matrix by the scalar multiplication and addition: A + B * scalestrictEquals
Analyzing the equivalent matrixequals
Negative floating point error is approximately equivalent to determining a matrixtoArray
Matrix transpose arrayfromArray
Transfer matrix arrayconstructor
Constructorclone
clone a Mat4 objectset
Sets the matrix with another one's valueequals
Check whether two matrix equalfuzzyEquals
Check whether two matrix equal with default degree of variance.toString
Transform to string with matrix informationsidentity
Set the matrix to the identity matrixtranspose
Transpose the values of a mat4invert
Inverts a mat4adjoint
Calculates the adjugate of a mat4determinant
Calculates the determinant of a mat4add
Adds two Mat4subtract
Subtracts the current matrix with another onemultiply
Subtracts the current matrix with another onemultiplyScalar
Multiply each element of the matrix by a scalar.translate
Translate a mat4 by the given vectorscale
Scales the mat4 by the dimensions in the given vec3rotate
Rotates a mat4 by the given angle around the given axisgetTranslation
Returns the translation vector component of a transformation matrix.getScale
Returns the scale factor component of a transformation matrixgetRotation
Returns the rotation factor component of a transformation matrixfromRTS
Restore the matrix values from a quaternion rotation, vector translation and vector scalefromQuat
Restore the matrix values from a quaternion rotationlerp
Linearly 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
other
Mat4 the second operandout
Mat4 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
number
Number amount to scale the matrix's elements byout
Mat4 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
other
Mat4 the second operandout
Mat4 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
rad
Unknown 旋转角度axis
Unknown 旋转轴
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
rad
Unknown 旋转角度
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
rad
Unknown 旋转角度
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
rad
Unknown 旋转角度
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
q
Unknown 旋转值v
Unknown 位移值s
Unknown 缩放值o
Unknown 指定变换中心
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
left
Unknown 左平面距离right
Unknown 右平面距离bottom
Unknown 下平面距离top
Unknown 上平面距离near
Unknown 近平面距离far
Unknown 远平面距离
perspective
Perspective projection matrix calculation
meta | description |
---|---|
Defined in | cocos2d/core/value-types/mat4.ts:1211 |
Parameters
fovy
Unknown 纵向视角高度aspect
Unknown 长宽比near
Unknown 近平面距离far
Unknown 远平面距离
ortho
Computing orthogonal projection matrix
meta | description |
---|---|
Defined in | cocos2d/core/value-types/mat4.ts:1247 |
Parameters
left
Unknown 左平面距离right
Unknown 右平面距离bottom
Unknown 下平面距离top
Unknown 上平面距离near
Unknown 近平面距离far
Unknown 远平面距离
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
eye
Unknown 当前位置center
Unknown 目标视点up
Unknown 视口上方向
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
ofs
Unknown 数组内的起始偏移量
fromArray
Transfer matrix array
meta | description |
---|---|
Defined in | cocos2d/core/value-types/mat4.ts:1624 |
Parameters
ofs
Unknown 数组起始偏移量
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
srcObj
Mat4
equals
Check whether two matrix equal
meta | description |
---|---|
Returns | Boolean |
Defined in | cocos2d/core/value-types/mat4.ts:1735 |
Parameters
other
Mat4
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
other
Mat4
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
out
Mat4 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
out
Mat4 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
out
Mat4 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
other
Mat4 the second operandout
Mat4 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
other
Mat4 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
other
Mat4 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
number
Number 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
v
Vec3 vector to translate byout
Mat4 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
v
Vec3 vector to scale byout
Mat4 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
rad
Number the angle to rotate the matrix byaxis
Vec3 the axis to rotate aroundout
Mat4 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
out
Vec3 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
out
Vec3 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
out
Quat 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
q
Quat 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 |