Mat4 Class

Extends ValueType

Module: cc Parent Module: cc

Representation of 4*4 matrix.

Index

Methods
  • constructor Constructor
  • clone clone a Mat4 object
  • set Sets the matrix with another one's value
  • equals Check whether two matrix equal
  • fuzzyEquals Check whether two matrix equal with default degree of variance.
  • toString Transform to string with matrix informations
  • identity Set the matrix to the identity matrix
  • transpose Transpose the values of a mat4
  • invert Inverts a mat4
  • adjoint Calculates the adjugate of a mat4
  • determinant Calculates the determinant of a mat4
  • add Adds two Mat4
  • sub Subtracts the current matrix with another one
  • mul Subtracts the current matrix with another one
  • mulScalar Multiply each element of the matrix by a scalar.
  • translate Translate a mat4 by the given vector
  • scale Scales the mat4 by the dimensions in the given vec3
  • rotate Rotates a mat4 by the given angle around the given axis
  • getTranslation Returns the translation vector component of a transformation matrix.
  • getScale Returns the scale factor component of a transformation matrix
  • getRotation Returns the rotation factor component of a transformation matrix
  • fromRTS Restore the matrix values from a quaternion rotation, vector translation and vector scale
  • fromQuat Restore the matrix values from a quaternion rotation
  • mat4 The convenience method to create a new cc.Mat4.
  • lerp Linearly interpolates between this value to to value by ratio which is in the range [0, 1].

Details

Methods

constructor

Constructor see cc.mat4

meta description
Defined in cocos2d/core/value-types/mat4.js:43
Parameters
  • m00 Number Component in column 0, row 0 position (index 0)
  • m01 Number Component in column 0, row 1 position (index 1)
  • m02 Number Component in column 0, row 2 position (index 2)
  • m03 Number Component in column 0, row 3 position (index 3)
  • m10 Number Component in column 1, row 0 position (index 4)
  • m11 Number Component in column 1, row 1 position (index 5)
  • m12 Number Component in column 1, row 2 position (index 6)
  • m13 Number Component in column 1, row 3 position (index 7)
  • m20 Number Component in column 2, row 0 position (index 8)
  • m21 Number Component in column 2, row 1 position (index 9)
  • m22 Number Component in column 2, row 2 position (index 10)
  • m23 Number Component in column 2, row 3 position (index 11)
  • m30 Number Component in column 3, row 0 position (index 12)
  • m31 Number Component in column 3, row 1 position (index 13)
  • m32 Number Component in column 3, row 2 position (index 14)
  • m33 Number Component in column 3, row 3 position (index 15)
clone

clone a Mat4 object

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:95
set

Sets the matrix with another one's value

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:110
Parameters
equals

Check whether two matrix equal

meta description
Returns Boolean
Defined in cocos2d/core/value-types/mat4.js:139
Parameters
fuzzyEquals

Check whether two matrix equal with default degree of variance.

meta description
Returns Boolean
Defined in cocos2d/core/value-types/mat4.js:150
Parameters
toString

Transform to string with matrix informations

meta description
Returns string
Defined in cocos2d/core/value-types/mat4.js:163
identity

Set the matrix to the identity matrix

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:180
transpose

Transpose the values of a mat4

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:190
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.js:201
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.js:212
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.js:223
add

Adds two Mat4

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:232
Parameters
  • other Mat4 the second operand
  • 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.
sub

Subtracts the current matrix with another one

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:244
Parameters
  • other Mat4 the second operand
  • 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
mul

Subtracts the current matrix with another one

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:256
Parameters
  • other Mat4 the second operand
  • 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
mulScalar

Multiply each element of the matrix by a scalar.

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:268
Parameters
  • number Number amount to scale the matrix's elements by
  • 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
translate

Translate a mat4 by the given vector

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:280
Parameters
  • v Vec3 vector to translate by
  • 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
scale

Scales the mat4 by the dimensions in the given vec3

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:292
Parameters
  • v Vec3 vector to scale by
  • 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
rotate

Rotates a mat4 by the given angle around the given axis

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:304
Parameters
  • rad Number the angle to rotate the matrix by
  • axis Vec3 the axis to rotate around
  • 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
getTranslation

Returns the translation vector component of a transformation matrix.

meta description
Returns Vec3
Defined in cocos2d/core/value-types/mat4.js:317
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.js:328
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.js:339
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.js:350
Parameters
  • q Quat Rotation quaternion
  • v Vec3 Translation vector
  • s Vec3 Scaling vector
fromQuat

Restore the matrix values from a quaternion rotation

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:363
Parameters
  • q Quat Rotation quaternion
mat4

The convenience method to create a new cc.Mat4.

meta description
Returns Mat4
Defined in cocos2d/core/value-types/mat4.js:375
Parameters
  • m00 Number Component in column 0, row 0 position (index 0)
  • m01 Number Component in column 0, row 1 position (index 1)
  • m02 Number Component in column 0, row 2 position (index 2)
  • m03 Number Component in column 0, row 3 position (index 3)
  • m10 Number Component in column 1, row 0 position (index 4)
  • m11 Number Component in column 1, row 1 position (index 5)
  • m12 Number Component in column 1, row 2 position (index 6)
  • m13 Number Component in column 1, row 3 position (index 7)
  • m20 Number Component in column 2, row 0 position (index 8)
  • m21 Number Component in column 2, row 1 position (index 9)
  • m22 Number Component in column 2, row 2 position (index 10)
  • m23 Number Component in column 2, row 3 position (index 11)
  • m30 Number Component in column 3, row 0 position (index 12)
  • m31 Number Component in column 3, row 1 position (index 13)
  • m32 Number Component in column 3, row 2 position (index 14)
  • m33 Number Component in column 3, row 3 position (index 15)
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.js:67
Parameters

results matching ""

    No results matching ""