Square matrix for 2-dimensional transformations. More...
#include <gelMatrix.h>
Public Member Functions | |
Gel3x3Matrix () | |
Default constructor. | |
Gel3x3Matrix (const float matrix[16]) | |
Convenience constructor. | |
void | loadNull () |
Sets all matrix entries to zero. | |
void | loadIdentity () |
Resets the matrix to its identity. | |
void | translate (Gel2dVec pos) |
Translates the matrix. | |
void | rotate (float rot) |
Rotates the matrix. | |
void | rotateRad (float rot) |
Rotates the matrix. | |
void | scale (Gel2dVec scl) |
Scales the matrix. | |
void | shear (float shx, float shy) |
Shears the matrix. | |
bool | isIdentity () const |
Determines whether or not this is an identity matrix. | |
bool | isTranslation () const |
Determines whether or not this is a pure translation matrix. | |
bool | isRotation () const |
Determines whether or not this is a pure rotation matrix. | |
bool | isScaling () const |
Determines whether or not this is a pure scaling matrix. | |
bool | isShearing () const |
Determines whether or not this is a pure shearing matrix. | |
void | toOGLMatrix (float matrix[16]) const |
Converts the matrix to an OpenGL-style matrix. | |
void | dump () const |
Writes the matrix's elements to the standard output (stdout). | |
Gel3x3Matrix | operator+ (const Gel3x3Matrix &m) const |
Gel3x3Matrix | operator- (const Gel3x3Matrix &m) const |
Gel3x3Matrix | operator* (const Gel3x3Matrix &m) const |
Gel3x3Matrix | operator= (const Gel3x3Matrix &m) |
Gel3x3Matrix | operator+= (const Gel3x3Matrix &m) |
Gel3x3Matrix | operator-= (const Gel3x3Matrix &m) |
Gel3x3Matrix | operator*= (const Gel3x3Matrix &m) |
bool | operator== (const Gel3x3Matrix &m) const |
bool | operator!= (const Gel3x3Matrix &m) const |
Gel2dVec | operator* (const Gel2dVec &v) const |
Transforms a vector by this matrix. | |
Public Attributes | |
union { | |
float m [3][3] | |
struct { | |
float m11 | |
float m12 | |
float m13 | |
float m21 | |
float m22 | |
float m23 | |
float m31 | |
float m32 | |
float m33 | |
} | |
}; |
Square matrix for 2-dimensional transformations.
Although this class is fully functional, it has not been specifically optimized in any way. OpenGL's matrix multiplication is probably much faster than this.
gel::Gel3x3Matrix::Gel3x3Matrix | ( | ) |
Default constructor.
Sets the matrix to its identity.
gel::Gel3x3Matrix::Gel3x3Matrix | ( | const float | matrix[16] | ) |
Convenience constructor.
Loads an OpenGL-style matrix.
void gel::Gel3x3Matrix::loadNull | ( | ) |
Sets all matrix entries to zero.
void gel::Gel3x3Matrix::loadIdentity | ( | ) |
Resets the matrix to its identity.
void gel::Gel3x3Matrix::translate | ( | Gel2dVec | pos | ) |
Translates the matrix.
pos | : The vector to translate the matrix by. |
void gel::Gel3x3Matrix::rotate | ( | float | rot | ) |
Rotates the matrix.
rot | : The number of degrees to rotate the matrix. |
void gel::Gel3x3Matrix::rotateRad | ( | float | rot | ) |
Rotates the matrix.
rot | : The amount of rotation in radians. |
void gel::Gel3x3Matrix::scale | ( | Gel2dVec | scl | ) |
Scales the matrix.
scl | : The vector to scale the matrix by. |
void gel::Gel3x3Matrix::shear | ( | float | shx, |
float | shy | ||
) |
Shears the matrix.
shx | : The amount of shear along the X axis. |
shy | : The amount of shear along the Y axis. |
bool gel::Gel3x3Matrix::isIdentity | ( | ) | const |
Determines whether or not this is an identity matrix.
bool gel::Gel3x3Matrix::isTranslation | ( | ) | const |
Determines whether or not this is a pure translation matrix.
bool gel::Gel3x3Matrix::isRotation | ( | ) | const |
Determines whether or not this is a pure rotation matrix.
bool gel::Gel3x3Matrix::isScaling | ( | ) | const |
Determines whether or not this is a pure scaling matrix.
bool gel::Gel3x3Matrix::isShearing | ( | ) | const |
Determines whether or not this is a pure shearing matrix.
void gel::Gel3x3Matrix::toOGLMatrix | ( | float | matrix[16] | ) | const |
Converts the matrix to an OpenGL-style matrix.
matrix | : An array of 16 floats. |
void gel::Gel3x3Matrix::dump | ( | ) | const |
Writes the matrix's elements to the standard output (stdout).
Gel3x3Matrix gel::Gel3x3Matrix::operator+ | ( | const Gel3x3Matrix & | m | ) | const |
Gel3x3Matrix gel::Gel3x3Matrix::operator- | ( | const Gel3x3Matrix & | m | ) | const |
Gel3x3Matrix gel::Gel3x3Matrix::operator* | ( | const Gel3x3Matrix & | m | ) | const |
Gel3x3Matrix gel::Gel3x3Matrix::operator= | ( | const Gel3x3Matrix & | m | ) |
Gel3x3Matrix gel::Gel3x3Matrix::operator+= | ( | const Gel3x3Matrix & | m | ) |
Gel3x3Matrix gel::Gel3x3Matrix::operator-= | ( | const Gel3x3Matrix & | m | ) |
Gel3x3Matrix gel::Gel3x3Matrix::operator*= | ( | const Gel3x3Matrix & | m | ) |
bool gel::Gel3x3Matrix::operator== | ( | const Gel3x3Matrix & | m | ) | const |
bool gel::Gel3x3Matrix::operator!= | ( | const Gel3x3Matrix & | m | ) | const |
Transforms a vector by this matrix.
float gel::Gel3x3Matrix::m[3][3] |
float gel::Gel3x3Matrix::m11 |
float gel::Gel3x3Matrix::m12 |
float gel::Gel3x3Matrix::m13 |
float gel::Gel3x3Matrix::m21 |
float gel::Gel3x3Matrix::m22 |
float gel::Gel3x3Matrix::m23 |
float gel::Gel3x3Matrix::m31 |
float gel::Gel3x3Matrix::m32 |
float gel::Gel3x3Matrix::m33 |
union { ... } |
API Documentation by Mark D. Procarione | Generated by |