Support Forum G3D Web Page |
A 4x4 matrix. More...
Public Member Functions | |
Matrix4 (const Any &any) | |
Must be in one of the following forms: More... | |
Matrix4 (float r1c1, float r1c2, float r1c3, float r1c4, float r2c1, float r2c2, float r2c3, float r2c4, float r3c1, float r3c2, float r3c3, float r3c4, float r4c1, float r4c2, float r4c3, float r4c4) | |
Matrix4 (DoNotInitialize dni) | |
Matrix4 (const float *init) | |
init should be row major. More... | |
Matrix4 (const class Matrix3 &upper3x3, const class Vector3 &lastCol=Vector3::zero()) | |
a is the upper left 3x3 submatrix and b is the upper right 3x1 submatrix. More... | |
Matrix4 (const class CoordinateFrame &c) | |
Matrix4 (const double *init) | |
Matrix4 () | |
Matrix4::zero() More... | |
Matrix4 | adjoint () const |
Transpose of the cofactor matrix (used in computing the inverse). More... | |
class CoordinateFrame | approxCoordinateFrame () const |
Produces an RT transformation that nearly matches this Matrix4. More... | |
Matrix4 | cofactor () const |
Vector4 | column (int c) const |
void | deserialize (class BinaryInput &b) |
float | determinant () const |
bool | fuzzyEq (const Matrix4 &b) const |
void | getPerspectiveProjectionParameters (double &left, double &right, double &bottom, double &top, double &nearval, double &farval, float updirection=-1.0f) const |
If this is a perspective projection matrix created by Matrix4::perspectiveProjection, extract its parameters. More... | |
class Vector3 | homoMul (const class Vector3 &v, float w) const |
Homogeneous multiplication. More... | |
Matrix4 | inverse () const |
operator const float * () const | |
operator float * () | |
Returns a row-major pointer. More... | |
bool | operator!= (const Matrix4 &other) const |
Matrix4 | operator* (const Matrix4 &other) const |
Matrix4 | operator* (const float s) const |
Vector4 | operator* (const Vector4 &vector) const |
Matrix4 | operator+ (const Matrix4 &other) const |
bool | operator== (const Matrix4 &other) const |
float * | operator[] (int r) |
const float * | operator[] (int r) const |
const Vector4 & | row (int r) const |
void | serialize (class BinaryOutput &b) const |
Serializes row-major. More... | |
void | setColumn (int c, const Vector4 &v) |
void | setRow (int r, const class Vector4 &v) |
Any | toAny () const |
String | toString () const |
Matrix4 | transpose () const |
class Matrix2 | upper2x2 () const |
class Matrix3 | upper3x3 () const |
Static Public Member Functions | |
static Matrix4 | diagonal (float e00, float e11, float e22, float e33) |
static const Matrix4 & | identity () |
static Matrix4 | orthogonalProjection (float left, float right, float bottom, float top, float nearval, float farval, float upDirection=-1.0f) |
Constructs an orthogonal projection matrix from the given parameters. More... | |
static Matrix4 | orthogonalProjection (const class Rect2D &rect, float nearval, float farval, float upDirection=-1.0f) |
static Matrix4 | perspectiveProjection (double left, double right, double bottom, double top, double nearval, double farval, float upDirection=-1.0f) |
static Matrix4 | pitchDegrees (float deg) |
static Matrix4 | rollDegrees (float deg) |
static Matrix4 | scale (const Vector3 &v) |
3D scale matrix More... | |
static Matrix4 | scale (float x, float y, float z) |
3D scale matrix More... | |
static Matrix4 | scale (float s) |
3D scale matrix More... | |
static Matrix4 | translation (const Vector3 &v) |
3D translation matrix More... | |
static Matrix4 | translation (float x, float y, float z) |
static Matrix4 | yawDegrees (float deg) |
Create a rotation matrix that rotates deg degrees around the Y axis. More... | |
static const Matrix4 & | zero () |
A 4x4 matrix.
Do not subclass. Data is initialized to 0 when default constructed.
|
explicit |
Must be in one of the following forms:
G3D::Matrix4::Matrix4 | ( | float | r1c1, |
float | r1c2, | ||
float | r1c3, | ||
float | r1c4, | ||
float | r2c1, | ||
float | r2c2, | ||
float | r2c3, | ||
float | r2c4, | ||
float | r3c1, | ||
float | r3c2, | ||
float | r3c3, | ||
float | r3c4, | ||
float | r4c1, | ||
float | r4c2, | ||
float | r4c3, | ||
float | r4c4 | ||
) |
|
inline |
G3D::Matrix4::Matrix4 | ( | const float * | init | ) |
init should be row major.
G3D::Matrix4::Matrix4 | ( | const class Matrix3 & | upper3x3, |
const class Vector3 & | lastCol = Vector3::zero() |
||
) |
a is the upper left 3x3 submatrix and b is the upper right 3x1 submatrix.
The last row of the created matrix is (0,0,0,1).
G3D::Matrix4::Matrix4 | ( | const class CoordinateFrame & | c | ) |
G3D::Matrix4::Matrix4 | ( | const double * | init | ) |
G3D::Matrix4::Matrix4 | ( | ) |
Referenced by diagonal(), pitchDegrees(), rollDegrees(), scale(), translation(), and yawDegrees().
Matrix4 G3D::Matrix4::adjoint | ( | ) | const |
Transpose of the cofactor matrix (used in computing the inverse).
Note: This is in fact only one type of adjoint. More generally, an adjoint of a matrix is any mapping of a matrix which possesses certain properties. This returns the so-called adjugate or classical adjoint.
class CoordinateFrame G3D::Matrix4::approxCoordinateFrame | ( | ) | const |
Matrix4 G3D::Matrix4::cofactor | ( | ) | const |
Vector4 G3D::Matrix4::column | ( | int | c | ) | const |
void G3D::Matrix4::deserialize | ( | class BinaryInput & | b | ) |
float G3D::Matrix4::determinant | ( | ) | const |
Referenced by G3D::determinant().
|
inlinestatic |
bool G3D::Matrix4::fuzzyEq | ( | const Matrix4 & | b | ) | const |
void G3D::Matrix4::getPerspectiveProjectionParameters | ( | double & | left, |
double & | right, | ||
double & | bottom, | ||
double & | top, | ||
double & | nearval, | ||
double & | farval, | ||
float | updirection = -1.0f |
||
) | const |
If this is a perspective projection matrix created by Matrix4::perspectiveProjection, extract its parameters.
Uses double precision because the operations involved in projection involve divisions that can significantly impact precision.
Homogeneous multiplication.
Let k = M * [v w]^T. result = k.xyz() / k.w
|
static |
Matrix4 G3D::Matrix4::inverse | ( | ) | const |
|
inline |
|
inline |
Returns a row-major pointer.
bool G3D::Matrix4::operator!= | ( | const Matrix4 & | other | ) | const |
Matrix4 G3D::Matrix4::operator* | ( | const float | s | ) | const |
bool G3D::Matrix4::operator== | ( | const Matrix4 & | other | ) | const |
|
inline |
|
inline |
|
static |
Constructs an orthogonal projection matrix from the given parameters.
Near and far are the NEGATIVE of the near and far plane Z values (to follow OpenGL conventions).
|
static |
|
inlinestatic |
|
inlinestatic |
const Vector4& G3D::Matrix4::row | ( | int | r | ) | const |
3D scale matrix
Referenced by scale().
|
inlinestatic |
3D scale matrix
|
inlinestatic |
3D scale matrix
void G3D::Matrix4::serialize | ( | class BinaryOutput & | b | ) | const |
Serializes row-major.
void G3D::Matrix4::setColumn | ( | int | c, |
const Vector4 & | v | ||
) |
void G3D::Matrix4::setRow | ( | int | r, |
const class Vector4 & | v | ||
) |
Any G3D::Matrix4::toAny | ( | ) | const |
String G3D::Matrix4::toString | ( | ) | const |
|
inlinestatic |
Matrix4 G3D::Matrix4::transpose | ( | ) | const |
class Matrix2 G3D::Matrix4::upper2x2 | ( | ) | const |
class Matrix3 G3D::Matrix4::upper3x3 | ( | ) | const |
|
inlinestatic |
Create a rotation matrix that rotates deg degrees around the Y axis.
|
static |