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. More... | |
Matrix4 (const Vector &) | |
Create a homogeneous diagonal matrix with diagonal terms set to the vector entries. More... | |
Matrix4 (const Matrix &) | |
Create an homogeneous matrix from a simple Matrix. More... | |
Matrix4 (const Matrix &, const Vector &) | |
Create an homogeneous matrix from a simple Matrix and a translation vector. More... | |
Matrix4 (const Matrix &, const Vector &, const Vector &) | |
Constructor from a Matrix, a translation and a shear vector. More... | |
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. More... | |
Matrix4 & | operator*= (double) |
Destructive scalar multiply. | |
Matrix4 & | operator/= (double) |
Destructive scalar divide. | |
Vector | operator* (const Vector &) const |
Right multiply by a vector. More... | |
double | Determinant () const |
Compute the determinant of the matrix. More... | |
double | Trace () const |
Compute the trace (sum of diagonal terms). | |
Matrix4 | T () const |
Transpose a matrix. | |
void | Float (float[16]) const |
Convert to a generic 4×4 float matrix. More... | |
Matrix | Rotation () const |
Return the rotation matrix. | |
Static Public Member Functions | |
static Matrix4 | LookAt (const Vector &, const Vector &, const double &) |
Create a viewing transformation matrix. More... | |
static Matrix4 | Rotation (const Vector &, const double &) |
Create a rotation matrix about an arbitrary axis. More... | |
static Matrix4 | Rotation (const Vector &) |
Create a rotation matrix about the orthogonal axes. More... | |
static Matrix4 | Scale (const Vector &) |
Creates a scaling matrix. More... | |
static Matrix4 | Translate (const Vector &) |
Creates a translation matrix. More... | |
static Matrix4 | Shear (const Vector &) |
Creates a shear matrix. More... | |
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 Inverse(const Matrix4&)). | |
Friends | |
Matrix4 | operator+ (const Matrix4 &, const Matrix4 &) |
Overloaded. More... | |
Matrix4 | operator- (const Matrix4 &, const Matrix4 &) |
Overloaded. More... | |
Matrix4 | operator* (const Matrix4 &, const Matrix4 &) |
Multiplication. More... | |
Matrix4 | Inverse (const Matrix4 &) |
Computes the inverse of a matrix A-1. More... | |
std::ostream & | operator<< (std::ostream &, const Matrix4 &) |
Overloaded. More... | |
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. |
Create a viewing transformation matrix.
eye | Eye location. |
look | Look at position. |
twist | Twisting angle from vertical. |
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. |
Creates a translation matrix.
t | Translation vector. |
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.
m | Argument matrix. |
Multiplication.
u,v | Argument matrix. |
Overloaded.
u,v | Argument matrixes. |
Overloaded.
u,v | Argument matrixes. |
|
friend |
Overloaded.
s | Stream. |
matrix | The matrix. |