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 (const Vector3 & position, const Quaternion & rotation, const Vector3 & scale)

Matrix4 (const Matrix3 & matrix)

Matrix4 ()

areal

determinant () const

void

direction (const Vector3 & direction, const Vector3 & up)

Vector3

euler ()

void

identity ()

Matrix4

inverse () const

void

reflect (const Vector4 & plane)

void

rotate (const Vector3 & axis, areal angle)

void

rotate (const Vector3 & angles)

Matrix3

rotation () const

void

scale (const Vector3 & vector)

void

translate (const Vector3 & vector)

Matrix4

transpose () const

void

zero ()

bool

operator!= (const Matrix4 & matrix) const

Vector3

operator* (const Vector3 & vector) const

Vector4

operator* (const Vector4 & vector) const

Matrix4

operator* (areal factor) const

Matrix4

operator* (const Matrix4 & matrix) const

Matrix4 &

operator*= (areal factor)

Matrix4 &

operator*= (const Matrix4 & matrix)

Matrix4

operator+ (const Matrix4 & matrix) const

Matrix4 &

operator+= (const Matrix4 & matrix)

Matrix4

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

Matrix4

lookAt (const Vector3 & eye, const Vector3 & target, const Vector3 & up)

Matrix4

ortho (areal left, areal right, areal bottom, areal top, areal znear, areal zfar)

Matrix4

perspective (areal fov, areal aspect, areal znear, areal zfar)

Methods Description

Matrix4::Matrix4 (Vector3 & position, Quaternion & rotation, Vector3 & scale)

Constructs matrix by given position, rotation and scale.


Matrix4::Matrix4 (Matrix3 & matrix)

Constructs a transform matrix with rotation matrix.


Matrix4::Matrix4 ()

Constructs an identity matrix.


areal Matrix4::determinant () const

Returns the matrix determinant.


void Matrix4::direction (Vector3 & direction, Vector3 & up)

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.


Matrix4 Matrix4::lookAt (Vector3 & eye, Vector3 & target, Vector3 & up)

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 & axis, areal angle)

Rotate this matrix around axis to angle in degrees.


void Matrix4::rotate (Vector3 & angles)

Rotate this matrix with Euler angles represented by Vector3(pitch, yaw, roll) 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.


Vector3 Matrix4::operator* (Vector3 & vector) const

Returns the result of multiplying this matrix and the given 3D vector.


Vector4 Matrix4::operator* (Vector4 & vector) const

Returns the result of multiplying this matrix and the given 4D vector.


Matrix4 Matrix4::operator* (areal factor) const

Returns the result of multiplying this matrix and the given factor.


Matrix4 Matrix4::operator* (Matrix4 & matrix) const

Returns the result of multiplying this matrix by the given matrix.

Note that matrix multiplication is not commutative, i.e. a*b != b*a.


:ref:`Matrix4<api_Matrix4>`& Matrix4::operator*= (areal factor)

Multiplies all elements of this matrix by factor.


Matrix4 & matrix)

Returns the result of multiplying this matrix by the given matrix.


Matrix4 Matrix4::operator+ (Matrix4 & matrix) const

Returns the sum of this matrix and the given matrix.


Matrix4 & matrix)

Adds the contents of matrix to this matrix.


Matrix4 Matrix4::operator- (Matrix4 & matrix) const

Returns the difference of this matrix and the given matrix.


Matrix4 & 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.