class Mat4 (shared-side)
Available since version: 0.2
This class represents 4x4 matrix.
Constructor
Mat4()
Parameters:
No parameters.
Constructor
Mat4(float value)
Parameters:
floatvalue: the initial value for each matrix cell.
Constructor
Mat4(Vec4 v0, Vec4 v1, Vec4 v2, Vec4 v3)
Parameters:
Vec4v0: the initial value for 1st row of the matrix.Vec4v1: the initial value for 2nd row of the matrix.Vec4v2: the initial value for 3rd row of the matrix.Vec4v3: the initial value for 4th row of the matrix.
Properties
No properties.
Methods
makeIdentity
This method will set all cells to the identity matrix.
void makeIdentity()
makeZero
This method will set all cells to zero.
void makeZero()
makeOrthonormal
This method will make the matric orthonormal.
void makeOrthonormal()
isUpper3x3Orthonormal
This method will is used check whether upper 3x3 matrix components are orthonormal.
bool isUpper3x3Orthonormal()
Returns bool:
true if upper 3x3 components are orthonormal, otherwise false.
transpose
This method will return the transpose of the matrix. The transposed matrix is the one that has the Matrix4x4's columns exchanged with its rows.
Mat4 transpose()
Returns Mat4:
the transposed matrix.
inverse
This method will return the inverse of the matrix. Inverted matrix is such that if multiplied by the original would result in identity matrix.
Mat4 inverse()
Returns Mat4:
the inverted matrix.
inverseLinTrafo
This method will return the inverse linear transformation of the matrix.
It works almost exactly the same as inverse
with the difference that translation is applied.
Mat4 inverseLinTrafo()
Returns Mat4:
the inverted matrix.
rotate
This method will apply the matrix rotation to given vector and return a new one.
Vec3 rotate(Vec3 vec)
Parameters:
Vec3vec: the vector that will be used to produce the rotated one.
Returns Vec3:
the rotated vector.
getRightVector
This method will get the right vector from the matrix.
Vec3 getRightVector()
Returns Vec3:
the right vector.
setRightVector
This method will set the right vector for the matrix.
void setRightVector(Vec3 vec)
Parameters:
Vec3vec: the new right vector for the matrix.
getAtVector
This method will get the at vector from the matrix.
Vec3 getAtVector()
Returns Vec3:
the at vector.
setAtVector
This method will set the at vector for the matrix.
void setAtVector(Vec3 vec)
Parameters:
Vec3vec: the new at vector for the matrix.
getUpVector
This method will get the up vector from the matrix.
Vec3 getUpVector()
Returns Vec3:
the up vector.
setUpVector
This method will set the up vector for the matrix.
void setUpVector(Vec3 vec)
Parameters:
Vec3vec: the new up vector for the matrix.
getTranslation
Available since version: 0.2.1
This method will get the translation (aka position) from the matrix.
Vec3 getTranslation()
Returns Vec3:
the translation position.
setTranslation
Available since version: 0.2.1
This method will set the translation (aka position) for the matrix.
void setTranslation(Vec3 vec)
Parameters:
Vec3vec: the translation position.
setScaling
Available since version: 0.3.5.3
This method will set the scale for the matrix.
Vec3 setScaling()
Returns Vec3:
the scaling vector.
resetRotation
This method will reset the rotation of the matrix.
void resetRotation()
extractRotation
This method will extract the rotation matrix from the TRS matrix.
Mat3 extractRotation()
Returns Mat3:
the extracted rotation matrix.
extractScaling
This method will extract the scaling vector from the TRS matrix.
Vec3 extractScaling()
Returns Vec3:
the extracted scaling vector.
postRotateX
This method will perform the matrix post rotation operation on X axis.
void postRotateX(float angle)
Parameters:
floatangle: the angle in degrees.
postRotateY
This method will perform the matrix post rotation operation on Y axis.
void postRotateY(float angle)
Parameters:
floatangle: the angle in degrees.
postRotateZ
This method will perform the matrix post rotation operation on Z axis.
void postRotateZ(float angle)
Parameters:
floatangle: the angle in degrees.
preScale
This method will perform the matrix pre scale operation.
void preScale(Vec3 scale)
Parameters:
Vec3scale: the scale vector.
postScale
This method will perform the matrix post scale operation.
void postScale(Vec3 scale)
Parameters:
Vec3scale: the scale vector.
static swap
This method will swap all cells between two matricies.
void swap(Mat4 mat1, Mat4 mat2)
Parameters:
Mat4mat1: the matrix that will be used in swap operation.Mat4mat2: the matrix that will be used in swap operation.
static lookAt
Available since version: 0.2.1
This method will create a matrix that will hold position & rotation based of from, to, up vectors.
Mat4 lookAt(Vec3 from, Vec3 to, Vec3 up)
Parameters:
Vec3from: the source position.Vec3to: the target position.Vec3up: the up direction.
Returns Mat4:
the resulting transformation matrix
Callbacks
No callbacks.