A 3x3 transformation matrix. More...
Public Member Functions | |
float * | operator[] (int i) |
const float * | operator[] (int i) const |
const float * | array () const |
Matrix3 (float a, float b, float c, float d, float e, float f, float g, float h, float i) | |
void | set (float a, float b, float c, float d, float e, float f, float g, float h, float i) |
Matrix3 | operator* (const Matrix3 &) const |
Matrix3 & | operator*= (const Matrix3 &) |
Matrix3 | operator+ (const Matrix3 &) const |
Matrix3 & | operator+= (const Matrix3 &) |
Matrix3 | operator- (const Matrix3 &) const |
Matrix3 & | operator-= (const Matrix3 &) |
Matrix3 | operator* (float) const |
Matrix3 & | operator*= (float) |
Matrix3 | operator/ (float d) const |
Matrix3 & | operator/= (float d) |
Vector3 | operator* (const Vector3 &v) const |
Vector3 | transform (const Vector3 &v) const |
bool | operator!= (const Matrix3 &b) const |
bool | operator== (const Matrix3 &b) const |
float | determinant () const |
Matrix3 | inverse (float det) const |
Matrix3 | inverse () const |
void | makeIdentity () |
void | scaling (float) |
void | scaling (float, float, float) |
void | scaling (const Vector3 &v) |
void | rotationX (float) |
void | rotationY (float) |
void | rotationZ (float) |
void | rotation (float a) |
void | rotation (float a, float x, float y, float z) |
void | rotation (float a, const Vector3 &v) |
void | scale (float) |
void | scale (float, float, float=1) |
void | scale (const Vector3 &v) |
void | rotateX (float) |
void | rotateY (float) |
void | rotateZ (float) |
void | rotate (float a) |
void | rotate (float a, float x, float y, float z) |
void | rotate (float a, const Vector3 &v) |
void | skew (float a) |
void | append (Hash &) const |
Static Public Member Functions | |
static const Matrix3 & | identity () |
Public Attributes | |
float | a00 |
float | a10 |
float | a20 |
float | a01 |
float | a11 |
float | a21 |
float | a02 |
float | a12 |
float | a22 |
Static Public Attributes | |
static const Matrix3 | _identity |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Matrix3 &matrix) |
A 3x3 transformation matrix.
You multiply a Vector3 by one of these to go from one 3D space to another. This cannot represent 3D translations or perspective, use a Matrix4 for that. This is also often used to transform color spaces.
The data is stored packed together in OpenGL order, which is transposed from the way used in most modern graphics literature. This affects how the array() and [] operator work, these are all equal:
|
inline |
Initialize with a00=a, a01=b, a02=c, etc, ie the arguments are given as rows.
|
inline |
Return a pointer to the column number i.
|
inline |
Return a pointer to the column number i.
|
inline |
Return a pointer to a00. This array is in the correct order to send it to OpenGL.
Matrix3 Matrix3::operator* | ( | float | f | ) | const |
Multiplies every location by f.
Matrix3 & Matrix3::operator*= | ( | float | f | ) |
Multiplies every location by f.
Returns the transformation of v by this matrix.
|
inline |
Returns true if any of all 9 locations are different.
|
inline |
Returns true if all 9 locations are equal.
|
inline |
Return the determinant. Non-zero means the transformation can be inverted.
Matrix3 Matrix3::inverse | ( | float | det | ) | const |
Returns the inverse of this matrix where det is the precomputed determinant. This is useful if you already computed the determinant in order to see if you can invert the matrix.
|
inline |
Returns the inverse of this matrix. If determinant() is zero this will replace all the items with +/- infinity or zero.
References inverse().
Referenced by inverse().
|
inline |
Replace the contents with the identity.
void Matrix3::scaling | ( | float | x | ) |
Replace the contents with a uniform scale by x.
void Matrix3::scaling | ( | float | x, |
float | y, | ||
float | z | ||
) |
Replace the contents with a scale by x,y,z.
|
inline |
void Matrix3::rotationX | ( | float | angle | ) |
Replace the contents with a rotation by angle (in radians) around the X axis.
Referenced by rotateX().
void Matrix3::rotationY | ( | float | angle | ) |
Replace the contents with a rotation by angle (in radians) around the Y axis.
Referenced by rotateY().
void Matrix3::rotationZ | ( | float | angle | ) |
Replace the contents with a rotation by angle (in radians) around the Z axis.
Referenced by rotateZ().
|
inline |
Same as rotationZ(angle).
Referenced by rotate().
void Matrix3::rotation | ( | float | a, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Replace the contents with a rotation by angle (in radians) around the vector x,y,z.
|
inline |
Replace the contents with a rotation by angle (in radians) around the vector.
References rotation().
Referenced by rotation().
void Matrix3::scale | ( | float | s | ) |
Scale the transformation by s.
void Matrix3::scale | ( | float | x, |
float | y, | ||
float | z = 1 |
||
) |
Scale the transformation by x,y,z.
|
inline |
void Matrix3::rotateX | ( | float | a | ) |
Rotate the transformation by a radians about the X axis.
References rotationX().
void Matrix3::rotateY | ( | float | a | ) |
Rotate the transformation by a radians about the Y axis.
References rotationY().
void Matrix3::rotateZ | ( | float | a | ) |
Rotate the transformation by a radians about the Z axis.
References rotationZ().
|
inline |
Same as rotateZ(a).
void Matrix3::rotate | ( | float | a, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Rotate the transformation by a radians about the vector x,y,z.
References rotation().
|
inline |
void Matrix3::skew | ( | float | a | ) |
Skew the transformation by a (X positions have a*Y added to them).
|
friend |
Writes it in nuke/tcl notation, with nested curly braces
©2021 The Foundry Visionmongers, Ltd. All Rights Reserved. |