Core 1.0
|
This class implements 42 matrix. More...
#include <matrix.h>
Public Member Functions | |
Matrix4 () | |
Empty. | |
Matrix4 (const double &) | |
Create an scaling matrix with the same diagonal terms. | |
Matrix4 (const Vector &) | |
Create a homogeneous diagonal matrix with diagonal terms set to the vector entries. | |
Matrix4 (const Matrix &) | |
Create an homogeneous matrix from a simple Matrix. | |
Matrix4 (const Matrix &, const Vector &) | |
Create an homogeneous matrix from a simple Matrix and a translation vector. | |
Matrix4 (const Matrix &, const Vector &, const Vector &) | |
Constructor from a Matrix, a translation and a shear vector. | |
Matrix4 (const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &, const double &) | |
Create a matrix given its coefficients. | |
Matrix4 | operator- () const |
Returns the opposite of a matrix -A. | |
Matrix4 & | operator+= (const Matrix4 &) |
Destructive addition. | |
Matrix4 & | operator-= (const Matrix4 &) |
Destructive subtraction. | |
Matrix4 & | operator*= (const Matrix4 &) |
Destructive multiplication. | |
Matrix4 & | operator*= (double) |
Destructive scalar multiply. | |
Matrix4 & | operator/= (double) |
Destructive scalar divide. | |
Vector | operator* (const Vector &) const |
Right multiply by a vector. | |
QString | ToGLSL () const |
Return a string expression. | |
double | Determinant () const |
Compute the determinant of the matrix. | |
double | Trace () const |
Compute the trace (sum of diagonal terms). | |
Matrix4 | T () const |
Transpose a matrix. | |
Matrix4 | Inverse () const |
Computes the inverse of a matrix A-1. | |
void | Float (float[16]) const |
Convert to a generic 4×4 float matrix. | |
Matrix | Sub () const |
Return the sub-matrix obtained by removing the last column and row. | |
Static Public Member Functions | |
static Matrix4 | LookAt (const Vector &, const Vector &, const double &) |
Create a viewing transformation matrix. | |
static Matrix4 | Perspective (const double &, const double &, const double &, const double &, const double &) |
Perspective projection matrix. | |
static Matrix4 | Rotation (const Vector &, const double &) |
Create a rotation matrix about an arbitrary axis. | |
static Matrix4 | Rotation (const Vector &) |
Create a rotation matrix about the orthogonal axes. | |
static Matrix4 | Scale (const Vector &) |
Creates a scaling matrix. | |
static Matrix4 | Translate (const Vector &) |
Creates a translation matrix. | |
static Matrix4 | Shear (const Vector &) |
Creates a shear matrix. | |
Static Public Attributes | |
static const Matrix4 | Null |
Null matrix. | |
static const Matrix4 | Identity |
Identity matrix. | |
static const Matrix4 | Hermite |
Hermite matrix, usefull for bi-cubic Hermite interpolation. | |
Protected Attributes | |
double | r [16] = { 1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0 } |
Coefficients. | |
Static Protected Attributes | |
static const double | epsilon = 1.0e-18 |
Epsilon value used to check if the determinant of a matrix is null (used in Matrix4::Inverse()). | |
Friends | |
Matrix4 | operator+ (const Matrix4 &u, const Matrix4 &v) |
Overloaded. | |
Matrix4 | operator- (const Matrix4 &u, const Matrix4 &v) |
Overloaded. | |
Matrix4 | operator* (const Matrix4 &u, const Matrix4 &v) |
Multiplication. | |
Matrix4 | operator* (const Matrix4 &A, const double &r) |
Multiplication by a real. | |
std::ostream & | operator<< (std::ostream &s, const Matrix4 &matrix) |
Overloaded. | |
This class implements 42 matrix.
Components are stored in a single dimension array, starting from element a00 and sorting components by column.
The diagonal elements of a matrix A are A00=A[0], A11=A[5], A22=A[10], A33=A[15]. The terms corresponding to the translation vector are A[12], A[13], A[14].
|
explicit |
Create an scaling matrix with the same diagonal terms.
The last term of the matrix is set to 1.0.
a | Value of diagonal entries. |
|
explicit |
Create a homogeneous diagonal matrix with diagonal terms set to the vector entries.
Last diagonal entry is set to 1.0.
a | Vector of diagonal entries. |
|
explicit |
double Matrix4::Determinant | ( | ) | const |
Compute the determinant of the matrix.
void Matrix4::Float | ( | float | a[16] | ) | const |
Convert to a generic 4×4 float matrix.
a | Returned matrix. |
Matrix4 Matrix4::Inverse | ( | ) | const |
Computes the inverse of a matrix A-1.
This function returns the null matrix if A cannot be inverted. The threshold value involved in the singular matrix detection is set to 10-18.
Create a viewing transformation matrix.
eye | Eye location. |
look | Look at position. |
twist | Twisting angle from vertical. |
|
static |
Perspective projection matrix.
fovy | Vertical field of view. |
zNear,zFar | Near and far distance. |
width,height | Screen width and heigh. |
Create a rotation matrix about the orthogonal axes.
u | Vector of angles in radian. |
Create a rotation matrix about an arbitrary axis.
v | Axis (should be normalized). |
a | Angle. |
Creates a scaling matrix.
u | Scaling vector. |
QString Matrix4::ToGLSL | ( | ) | const |
Return a string expression.
Yields a QString of the form 'mat4(m(0, 0), ..., m(3, 3))' that write the matrix in GLSL.
Creates a translation matrix.
t | Translation vector. |
Multiplication by a real.
A | matrix. |
r | Real. |
Multiplication.
u,v | Argument matrix. |
Overloaded.
u,v | Argument matrixes. |
Overloaded.
u,v | Argument matrixes. |
|
friend |
Overloaded.
s | Stream. |
matrix | The matrix. |