ofMatrix3x3
The 3x3 matrix can hold the values needed to transform a 2d vertex, which is pretty handy when you want to do things like move vertices around, rotate them, etc. The 3x3 is pretty important because it allows you to have both a rotation and a transformation in the same little old object. You won't see them used a great deal because it's usually easier to use the rotate() and translate() methods of ofVec2f but they are handy sometimes. You'll probably see the ofMatrix4x4 used more often, because it allows you to represent a camera or a projection mathematically, and that's pretty useful in doing 3d graphics. They're also used in ofxOpenCv sometimes to represent information about cameras.
determinant( ... )
float determinant(const ofMatrix3x3 &A)entrywiseTimes( ... )
ofMatrix3x3 entrywiseTimes(const ofMatrix3x3 &A)Multiply a matrix by a matrix entry by entry (i.e. aa, bb, c*c...)
This is referred to as an entrywise, Hadamard, or Schur product.
inverse( ... )
ofMatrix3x3 inverse(const ofMatrix3x3 &A)Inverse of a 3x3 matrix
the inverse is the adjoint divided through the determinant find the matrix of minors (minor = determinant of 2x2 matrix of the 2 rows/colums current element is NOT in) turn them in cofactors (= change some of the signs) find the adjoint by transposing the matrix of cofactors divide this through the determinant to get the inverse
See also: invert();
invert( )
void invert()ofMatrix3x3( ... )
ofMatrix3x3(const glm::mat3 &mat)ofMatrix3x3( ... )
ofMatrix3x3(float _a, float _b, float _c, float _d, float _e, float _f, float _g, float _h, float _i)\name Constructor {
operator*( ... )
ofMatrix3x3 operator*(const ofMatrix3x3 &B)Multiply a 3x3 matrix with a 3x3 matrix
operator*( ... )
ofMatrix3x3 operator*(float scalar)Multiply a matrix with a scalar
operator*=( ... )
void operator*=(const ofMatrix3x3 &B)Multiply a matrix by a matrix this = this*B (in that order)
operator*=( ... )
void operator*=(float scalar)Multiply a matrix by a scalar (multiples all entries by scalar)
operator+( ... )
ofMatrix3x3 operator+(const ofMatrix3x3 &B)Add two matrices
operator+=( ... )
void operator+=(const ofMatrix3x3 &B)Add matrix to existing matrix
operator-( ... )
ofMatrix3x3 operator-(const ofMatrix3x3 &B)Subtract two matrices
operator-=( ... )
void operator-=(const ofMatrix3x3 &B)Subtract matrix from existing matrix
operator/( ... )
ofMatrix3x3 operator/(float scalar)Divide a matrix through a scalar
operator/=( ... )
void operator/=(const ofMatrix3x3 &B)operator/=( ... )
void operator/=(float scalar)operator[]( ... )
float & operator[](const int &index)set( ... )
void set(float _a, float _b, float _c, float _d, float _e, float _f, float _g, float _h, float _i)\name Matrix access {
transpose( ... )
ofMatrix3x3 transpose(const ofMatrix3x3 &A)Transpose without changing the matrix. Uses the "swap" method with additions and subtractions to swap the elements that aren't on the main diagonal.
Returns: transposed matrix.
transpose( )
void transpose()Transpose the matrix
This changes the matrix.
[ a b c ]T [ a d g ]
[ d e f ] = [ b e h ]
[ g h i ] [ c f i ]