Matrix4
Inherited: None
Description
Internally the data is stored as column-major format, so as to be optimal for passing to OpenGL functions, which expect column-major data.
Public Methods
Matrix4 () |
|
Matrix4 (const Matrix3 & matrix) |
|
Matrix4 (const Vector3 & position, const Quaternion & rotation, const Vector3 & scale) |
|
areal |
determinant () const |
void |
direction (const Vector3 & direction, const Vector3 & up) |
euler () |
|
void |
identity () |
inverse () const |
|
void |
reflect (const Vector4 & plane) |
void |
rotate (const Vector3 & angles) |
void |
rotate (const Vector3 & axis, areal angle) |
rotation () const |
|
void |
scale (const Vector3 & vector) |
void |
translate (const Vector3 & vector) |
transpose () const |
|
void |
zero () |
bool |
operator!= (const Matrix4 & matrix) const |
operator* (areal factor) const |
|
operator* (const Matrix4 & matrix) const |
|
operator* (const Vector3 & vector) const |
|
operator* (const Vector4 & vector) const |
|
Matrix4 & |
operator*= (areal factor) |
Matrix4 & |
operator*= (const Matrix4 & matrix) |
operator+ (const Matrix4 & matrix) const |
|
Matrix4 & |
operator+= (const Matrix4 & matrix) |
operator- (const Matrix4 & matrix) const |
|
Matrix4 & |
operator-= (const Matrix4 & matrix) |
bool |
operator== (const Matrix4 & matrix) const |
areal |
operator[] (int i) |
areal |
operator[] (int i) const |
Static Methods
lookAt (const Vector3 & eye, const Vector3 & target, const Vector3 & up) |
|
ortho (areal left, areal right, areal bottom, areal top, areal znear, areal zfar) |
|
perspective (areal fov, areal aspect, areal znear, areal zfar) |
Methods Description
Matrix4::Matrix4 ()
Constructs an identity matrix.
Matrix4::Matrix4 (Matrix3 & matrix)
Constructs a transform matrix with rotation matrix.
Matrix4::Matrix4 (Vector3 & position, Quaternion & rotation, Vector3 & scale)
Constructs matrix by given position, rotation and scale.
areal Matrix4::determinant () const
Returns the matrix determinant.
Creates a rotation matrix based on direction and up vectors.
Vector3 Matrix4::euler ()
Returns an Euler angles represented by Vector3(pitch, yaw, roll) in rotation degrees.
void Matrix4::identity ()
Resets this matrix to an identity matrix.
Matrix4 Matrix4::inverse () const
Returns an inverted copy of this matrix.
Creates a transformation matrix that corresponds to a camera viewing the target from the source. Receiving eye point, a target point, and an up vector.
Matrix4 Matrix4::ortho (areal left, areal right, areal bottom, areal top, areal znear, areal zfar)
Creates an orthogonal projection matrix. Creates a view showing the area between left, right, top and bottom, with znear and zfar set up the depth clipping planes.
Matrix4 Matrix4::perspective (areal fov, areal aspect, areal znear, areal zfar)
Creates a perspective projection matrix. fov is the vertical field-of-view in degrees of the perspective matrix, aspect is the aspect ratio (width divided by height). znear and zfar set up the depth clipping planes.
void Matrix4::reflect (Vector4 & plane)
Constructs a matrix that reflects the coordinate system about the plane.
void Matrix4::rotate (Vector3 & angles)
Rotate this matrix with Euler angles represented by Vector3(pitch, yaw, roll) in degrees.
void Matrix4::rotate (Vector3 & axis, areal angle)
Rotate this matrix around axis to angle in degrees.
Matrix3 Matrix4::rotation () const
Returns rotation matrix from this matrix.
void Matrix4::scale (Vector3 & vector)
Scales the coordinate system by vector.
void Matrix4::translate (Vector3 & vector)
Move the coordinate system to vector.
Matrix4 Matrix4::transpose () const
Returns this matrix, transposed about its diagonal.
void Matrix4::zero ()
Clear this matrix, with 0.0 value for all components.
bool Matrix4::operator!= (Matrix4 & matrix) const
Returns true if this matrix is NOT equal to given matrix; otherwise returns false. This operator uses an exact floating-point comparison.
Matrix4 Matrix4::operator* (areal factor) const
Returns the result of multiplying this matrix and the given factor.
Returns the result of multiplying this matrix by the given matrix.
Note that matrix multiplication is not commutative, i.e. a*b != b*a.
Returns the result of multiplying this matrix and the given 3D vector.
Returns the result of multiplying this matrix and the given 4D vector.
Matrix4 & Matrix4::operator*= (areal factor)
Multiplies all elements of this matrix by factor.
Returns the result of multiplying this matrix by the given matrix.
Returns the sum of this matrix and the given matrix.
Adds the contents of matrix to this matrix.
Returns the difference of this matrix and the given matrix.
Subtracts the contents of matrix from this matrix.
bool Matrix4::operator== (Matrix4 & matrix) const
Returns true if this matrix is equal to given matrix; otherwise returns false. This operator uses an exact floating-point comparison.
areal Matrix4::operator[] (int i)
Returns the component of the matrix at i*ndex position *i as a modifiable reference. i must be a valid i*ndex position *i*n the matrix (i.e., 0 <= *i < 16). Data *i*s stored as column-major format so this function retrieving data from rows *i*n colmns.
areal Matrix4::operator[] (int i) const
Returns the component of the matrix at i*ndex position. *i must be a valid i*ndex position *i*n the matrix (i.e., 0 <= *i < 16). Data *i*s stored as column-major format so this function retrieving data from rows *i*n colmns.