#include <GLMatrix.h>
Collaboration diagram for mathglpp::GLMatrix< T >:
Definition at line 35 of file GLMatrix.h.
Public Member Functions | |
GLMatrix () | |
Create an uninitialised matrix. | |
GLMatrix (const T val) | |
Create an initialised matrix. | |
GLMatrix (const T *const val) | |
Create a matrix from an array*/. | |
GLMatrix (const T *const v0, const T *const v1, const T *const v2, const T *const v3) | |
Create a matrix from an array*/. | |
GLMatrix (const GLMatrix &mat) | |
Copy a matrix. | |
~GLMatrix () | |
Default destructor. | |
const T | det () const |
Get the matrix determinant. | |
GLMatrix | adjoint () const |
Get the adjoint matrix. | |
GLMatrix | inverse () const |
Adjoint method inverse, constant time inversion implementation. | |
GLVector4< T > | eigenValues () |
Return a vector of the eigen values of the matrix. | |
GLMatrix & | operator= (const GLMatrix &mat) |
Assign this matrix from another one. | |
bool | operator== (const GLMatrix &mat) |
Equality check. NB. May not be constant time, depending on memcmp. | |
T & | operator[] (const int ind) |
Direct access to the matrix elements, just remember they are in column major format!! | |
operator const T * (void) const | |
Implicit cast vector access as suggested by maquinn. | |
operator T * (void) | |
Implicit cast vector access as suggested by maquinn. | |
GLMatrix & | operator *= (const T &val) |
Multiply this matrix by a scalar. | |
GLMatrix & | operator/= (const T &val) |
Divide this matrix by a scalar. | |
GLMatrix & | operator+= (const GLMatrix &mat) |
Add a matrix to this matrix. | |
GLMatrix | operator+ (const GLMatrix &mat) |
Add a matrix to a copy of this matrix. | |
GLMatrix & | operator-= (const GLMatrix &mat) |
Subtract a matrix from this matrix. | |
GLMatrix | operator- (const GLMatrix &mat) |
Subtract a matrix from a copy of this matrix. | |
GLMatrix | operator * (const GLMatrix &mat) |
Get the matrix dot product, most commonly used form of matrix multiplication. | |
GLMatrix & | operator *= (const GLMatrix &mat) |
Apply the matrix dot product to this matrix. | |
GLMatrix & | mult3by3 (const GLMatrix &mat) |
Apply the matrix dot product to this matrix unrolling by sebastien bloc. | |
GLVector4< T > | operator * (const GLVector4< T > &vec) |
Get the matrix vector dot product, used to transform vertecies. | |
GLVector3< T > | operator * (const GLVector3< T > &vec) |
Get the matrix vector dot product with w = 1, use for transforming non 4D vectors. | |
GLVector2< T > | operator * (const GLVector2< T > &vec) |
Get the matrix vector dot product with w = 1, use for transforming non 4D vectors. | |
GLVector4< T > | operator * (const T *const v_arr) |
Get the matrix vector dot4 product, used to transform vertecies. | |
GLVector2< T > | dot2 (const T *const v_arr) const |
Get the matrix vector dot2 product, used to transform non-4D vertecies. | |
GLVector2< T > | dot2 (const T x, const T y, const T w=1) const |
Get the matrix vector dot2 product, used to transform non-4D vertecies. | |
void | vdot2 (T *const v_arr, const T w=1) const |
Get the matrix vector dot2 product, used to transform non-4D vertecies. | |
GLVector3< T > | dot3 (const T *const v_arr) const |
Get the matrix vector dot3 product, used to transform non-4D vertecies. | |
GLVector3< T > | dot3 (const T x, const T y, const T z, const T w=1) const |
Get the matrix vector dot3 product, used to transform non-4D vertecies. | |
void | vdot3 (T *const v_arr, const T w=1) const |
Get the matrix vector dot3 product, used to transform non-4D vertecies. | |
GLVector4< T > | dot4 (const T *const v_arr) const |
Get the matrix vector dot4 product, used to transform 4D vertecies. | |
void | vdot4 (T *const v_arr) const |
Get the matrix vector dot4 product, used to transform 4D vertecies. | |
GLVector4< T > | dot4 (const T x, const T y, const T z, const T w) |
Get the matrix vector dot4 product, used to transform 4D vertecies. | |
void | glVertex3v (const T *const v_arr) |
Transform the vertex and send it to OpenGL. | |
void | glVertex3 (const T x, const T y, const T z) |
Transform the vertex and send it to OpenGL. | |
void | glVertex4v (const T *const v_arr) |
Transform the vertex and send it to OpenGL. | |
void | glVertex4 (const T x, const T y, const T z, const T w) |
Transform the vertex and send it to OpenGL. | |
void | glVertex3v (const int num, const T *const v_arr) |
Transform a run of vertecies and send them to OpenGL. | |
void | glVertex4v (const int num, const T *const v_arr) |
Transform a run of vertecies and send them to OpenGL. | |
void | glMultMatrix (void) |
GL interface, glMultMatrix. | |
void | glLoadMatrix (void) |
GL interface, glLoadMatrix. | |
void | glGet (const GLenum pname) |
GL interface, glGet, gets a matrix from OpenGL. | |
GLMatrix & | transpose (void) |
Transpose the matrix. | |
GLMatrix | getTranspose (void) |
Return the transpose. | |
GLMatrix & | loadIdentity (void) |
Make this an identity matrix. | |
GLMatrix & | loadZero (void) |
Make this an identity matrix. | |
GLMatrix & | loadRotate (const T angle, T x, T y, T z) |
Make this an OpenGL rotation matrix. | |
GLMatrix & | loadRotateX (const T angle) |
Load rotate[X,Y,Z,XYZ] specialisations by sebastien bloc Make this an OpenGL rotation matrix: same as loadRotate(angle,1,0,0). | |
GLMatrix & | loadRotateY (const T angle) |
Make this an OpenGL rotation matri0: same as loadRotate(angle,0,1,0). | |
GLMatrix & | loadRotateZ (const T angle) |
Make this an OpenGL rotation matrix: same as loadRotateZ(angle,0,0,1). | |
GLMatrix & | applyRotate (const T angle, const T x, const T y, const T z) |
Apply an OpenGL rotation matrix to this. | |
GLMatrix & | applyRotateX (const T angle) |
Apply rotate[X,Y,Z,XYZ] specialisations by sebastien bloc Apply an OpenGL rotation matrix to this. | |
GLMatrix & | applyRotateY (const T angle) |
Apply an OpenGL rotation matrix to this. | |
GLMatrix & | applyRotateZ (const T angle) |
Apply an OpenGL rotation matrix to this. | |
GLMatrix & | applyRotateXYZ (const T x, const T y, const T z) |
Apply an OpenGL rotation matrix to this. | |
GLMatrix & | loadScale (const T x, const T y, const T z) |
Make this an OpenGL scale matrix. | |
GLMatrix & | applyScale (const T x, const T y) |
Apply an OpenGL scale matrix to this. | |
GLMatrix & | applyScale (const T x, const T y, const T z) |
Apply an OpenGL scale matrix to this. | |
GLMatrix & | applyScale (const GLVector2< T > &scale) |
Apply an OpenGL scale matrix to this. | |
GLMatrix & | applyScale (const GLVector3< T > &scale) |
Apply an OpenGL scale matrix to this. | |
GLMatrix & | loadTranslate (const T x, const T y, const T z) |
Make this an OpenGL translate matrix. | |
GLMatrix & | applyTranslate (const T x, const T y) |
Apply an OpenGL translate matrix to this. | |
GLMatrix & | applyTranslate (const T x, const T y, const T z) |
Apply an OpenGL translate matrix to this. | |
GLMatrix & | applyTranslate (const GLVector2< T > &trans) |
Apply an OpenGL translate matrix to this. | |
GLMatrix & | applyTranslate (const GLVector3< T > &trans) |
Apply an OpenGL translate matrix to this. | |
GLMatrix & | loadFrustum (const GLdouble left, const GLdouble right, const GLdouble bottom, const GLdouble top, const GLdouble zNear, const GLdouble zFar) |
Make this with an OpenGL frustum matrix. | |
GLMatrix & | loadOrtho (const GLdouble left, const GLdouble right, const GLdouble bottom, const GLdouble top, const GLdouble zNear, const GLdouble zFar) |
OpenGL orthogonal matrix. | |
GLMatrix & | loadView (const T fx, const T fy, const T fz, const T ux, const T uy, const T uz, const T sx, const T sy, const T sz) |
OpenGL View Matrix. | |
GLMatrix & | loadView (const T *const f, const T *const u, const T *const s) |
OpenGL View Matrix. | |
GLMatrix & | loadView (const GLVector3< T > &front, const GLVector3< T > &up, const GLVector3< T > side) |
OpenGL View Matrix. | |
template<> | |
mathglpp::GLMatrix< GLdouble > | glTranslate (const GLdouble _x, const GLdouble _y, const GLdouble _z) |
template<> | |
mathglpp::GLMatrix< GLfloat > | glTranslate (const GLfloat _x, const GLfloat _y, const GLfloat _z) |
template<> | |
mathglpp::GLMatrix< GLdouble > | glRotate (const GLdouble angle, GLdouble x, GLdouble y, GLdouble z) |
template<> | |
mathglpp::GLMatrix< GLfloat > | glRotate (const GLfloat angle, GLfloat x, GLfloat y, GLfloat z) |
template<> | |
void | glVertex3v (const int num, const GLfloat *const v_arr) |
template<> | |
void | glVertex3v (const int num, const GLdouble *const v_arr) |
template<> | |
void | glVertex4v (const int num, const GLfloat *const v_arr) |
template<> | |
void | glVertex4v (int num, const GLdouble *v_arr) |
Static Public Member Functions | |
static GLMatrix | identity (void) |
Special glMatricies Identity matrix. | |
static GLMatrix | zero (void) |
Zero matrix. | |
static GLMatrix | glRotate (const T angle, T x, T y, T z) |
OpenGL rotation matrix. | |
static GLMatrix | glScale (const T x, const T y, const T z) |
OpenGL scale matrix. | |
static GLMatrix | glTranslate (const T x, const T y, const T z) |
OpenGL translate matrix. | |
static GLMatrix | glFrustum (const GLdouble left, const GLdouble right, const GLdouble bottom, const GLdouble top, const GLdouble zNear, const GLdouble zFar) |
OpenGL frustum matrix. | |
static GLMatrix | glOrtho (const GLdouble left, const GLdouble right, const GLdouble bottom, const GLdouble top, const GLdouble zNear, const GLdouble zFar) |
OpenGL orthogonal matrix. | |
Protected Member Functions | |
const T | cofactorm0 () const |
Cofactor of m0. | |
const T | cofactorm1 () const |
Cofactor of m1. | |
const T | cofactorm2 () const |
Cofactor of m2. | |
const T | cofactorm3 () const |
Cofactor of m3. | |
const T | cofactorm4 () const |
Cofactor of m4. | |
const T | cofactorm5 () const |
Cofactor of m5. | |
const T | cofactorm6 () const |
Cofactor of m6. | |
const T | cofactorm7 () const |
Cofactor of m7. | |
const T | cofactorm8 () const |
Cofactor of m8. | |
const T | cofactorm9 () const |
Cofactor of m9. | |
const T | cofactorm10 () const |
Cofactor of m10. | |
const T | cofactorm11 () const |
Cofactor of m11. | |
const T | cofactorm12 () const |
Cofactor of m12. | |
const T | cofactorm13 () const |
Cofactor of m13. | |
const T | cofactorm14 () const |
Cofactor of m14. | |
const T | cofactorm15 () const |
Cofactor of m15. |
mathglpp::GLMatrix< T >::GLMatrix | ( | ) | [inline] |
Create an uninitialised matrix.
Definition at line 40 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::getTranspose(), and mathglpp::GLMatrix< value_type >::zero().
mathglpp::GLMatrix< T >::GLMatrix | ( | const T | val | ) | [inline] |
mathglpp::GLMatrix< T >::GLMatrix | ( | const T *const | val | ) | [inline] |
Create a matrix from an array*/.
Definition at line 48 of file GLMatrix.h.
00049 { memmove(m,val,16*sizeof(T)); }
mathglpp::GLMatrix< T >::GLMatrix | ( | const T *const | v0, | |
const T *const | v1, | |||
const T *const | v2, | |||
const T *const | v3 | |||
) | [inline] |
Create a matrix from an array*/.
Definition at line 52 of file GLMatrix.h.
00053 { 00054 memmove(m,v0,4*sizeof(T)); memmove(m+4,v1,4*sizeof(T)); 00055 memmove(m+8,v2,4*sizeof(T)); memmove(m+12,v3,4*sizeof(T)); 00056 }
mathglpp::GLMatrix< T >::GLMatrix | ( | const GLMatrix< T > & | mat | ) | [inline] |
mathglpp::GLMatrix< T >::~GLMatrix | ( | ) | [inline] |
const T mathglpp::GLMatrix< T >::det | ( | ) | const [inline] |
Get the matrix determinant.
Definition at line 67 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::eigenValues().
00068 { return m0 * cofactorm0() - m1 * cofactorm1() + m2 * cofactorm2() - m3 * cofactorm3(); }
GLMatrix mathglpp::GLMatrix< T >::adjoint | ( | ) | const [inline] |
Get the adjoint matrix.
Definition at line 71 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::inverse().
00072 { 00073 GLMatrix ret; 00074 ret[0] = cofactorm0(); 00075 ret[1] = -cofactorm4(); 00076 ret[2] = cofactorm8(); 00077 ret[3] = -cofactorm12(); 00078 ret[4] = -cofactorm1(); 00079 ret[5] = cofactorm5(); 00080 ret[6] = -cofactorm9(); 00081 ret[7] = cofactorm13(); 00082 ret[8] = cofactorm2(); 00083 ret[9] = -cofactorm6(); 00084 ret[10] = cofactorm10(); 00085 ret[11] = -cofactorm14(); 00086 ret[12] = -cofactorm3(); 00087 ret[13] = cofactorm7(); 00088 ret[14] = -cofactorm11(); 00089 ret[15] = cofactorm15(); 00090 return ret; 00091 }
GLMatrix mathglpp::GLMatrix< T >::inverse | ( | ) | const [inline] |
Adjoint method inverse, constant time inversion implementation.
Definition at line 94 of file GLMatrix.h.
00095 { 00096 GLMatrix ret(adjoint()); 00097 const T determinant = m0 * ret[0] + m1 * ret[4] + m2 * ret[8] + m3 * ret[12]; 00098 assert(determinant!=0 && "Singular matrix has no inverse"); 00099 ret /= determinant; 00100 return ret; 00101 }
GLVector4<T> mathglpp::GLMatrix< T >::eigenValues | ( | ) | [inline] |
Return a vector of the eigen values of the matrix.
Solve
Definition at line 104 of file GLMatrix.h.
00105 { 00106 LinearPolynomial<T> lpoly(5); 00107 lpoly[0] = det(); 00108 lpoly[1] = -_a*_f*_k -_a*_f*_p -_a*_k*_p -_f*_k*_p 00109 -(-_a -_f)*_l*_o 00110 -(-_a -_p)*_g*_j 00111 -(-_a -_k)*_h*_n 00112 -(-_k -_p)*_b*_e 00113 -(-_f -_p)*_c*_i 00114 -(-_f -_k)*_d*_n 00115 -_g*_l*_n -_h*_g*_o +_b*_g*_i -_b*_h*_m 00116 -_c*_e*_j -_c*_l*_n +_d*_i*_o; 00117 lpoly[2] = _a*(_f +_k +_p) +_f*(_k +_p) +_k*_p -_l*_o -_g*_j -_h*_n +_b*_e -_c*_i +_d*_n; 00118 lpoly[3] = -_a -_f -_k -_p; 00119 lpoly[4] = 1; 00120 00122 std::vector<T> roots = lpoly.findRoots(); 00123 00124 return GLVector4<T>(roots[0], roots[1], roots[2], roots[3]); 00125 }
GLMatrix& mathglpp::GLMatrix< T >::operator= | ( | const GLMatrix< T > & | mat | ) | [inline] |
Assign this matrix from another one.
Definition at line 128 of file GLMatrix.h.
00129 { memmove(m,mat.m,16*sizeof(T)); return *this; }
bool mathglpp::GLMatrix< T >::operator== | ( | const GLMatrix< T > & | mat | ) | [inline] |
Equality check. NB. May not be constant time, depending on memcmp.
Definition at line 132 of file GLMatrix.h.
00133 { return memcmp(m,mat.m,16*sizeof(T))==0; }
T& mathglpp::GLMatrix< T >::operator[] | ( | const int | ind | ) | [inline] |
Direct access to the matrix elements, just remember they are in column major format!!
Definition at line 136 of file GLMatrix.h.
00137 { assert(ind > -1 && ind < 16); return m[ind]; }
mathglpp::GLMatrix< T >::operator const T * | ( | void | ) | const [inline] |
Implicit cast vector access as suggested by maquinn.
Definition at line 140 of file GLMatrix.h.
00140 { return m; }
mathglpp::GLMatrix< T >::operator T * | ( | void | ) | [inline] |
Implicit cast vector access as suggested by maquinn.
Definition at line 143 of file GLMatrix.h.
00143 { return m; }
GLMatrix& mathglpp::GLMatrix< T >::operator *= | ( | const T & | val | ) | [inline] |
Multiply this matrix by a scalar.
Definition at line 146 of file GLMatrix.h.
00147 { for(register unsigned i = 0; i < 16; ++i) m[i] *= val; return *this; }
GLMatrix& mathglpp::GLMatrix< T >::operator/= | ( | const T & | val | ) | [inline] |
Divide this matrix by a scalar.
Definition at line 150 of file GLMatrix.h.
00151 { for(register unsigned i = 0; i < 16; ++i) m[i] /= val; return *this; }
GLMatrix& mathglpp::GLMatrix< T >::operator+= | ( | const GLMatrix< T > & | mat | ) | [inline] |
Add a matrix to this matrix.
Definition at line 154 of file GLMatrix.h.
00155 { for(register unsigned i = 0; i < 16; ++i) m[i] += mat.m[i]; return *this; }
GLMatrix mathglpp::GLMatrix< T >::operator+ | ( | const GLMatrix< T > & | mat | ) | [inline] |
Add a matrix to a copy of this matrix.
Definition at line 157 of file GLMatrix.h.
00158 { GLMatrix ret(*this); ret += mat; return ret; }
GLMatrix& mathglpp::GLMatrix< T >::operator-= | ( | const GLMatrix< T > & | mat | ) | [inline] |
Subtract a matrix from this matrix.
Definition at line 161 of file GLMatrix.h.
00162 { for(register unsigned i = 0; i < 16; ++i) m[i] -= mat.m[i]; return *this; }
GLMatrix mathglpp::GLMatrix< T >::operator- | ( | const GLMatrix< T > & | mat | ) | [inline] |
Subtract a matrix from a copy of this matrix.
Definition at line 165 of file GLMatrix.h.
00166 { GLMatrix ret(*this); ret -= mat; return ret; }
GLMatrix mathglpp::GLMatrix< T >::operator * | ( | const GLMatrix< T > & | mat | ) | [inline] |
Get the matrix dot product, most commonly used form of matrix multiplication.
Definition at line 169 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::glVertex4v().
00170 { 00171 GLMatrix ret; 00172 ret.m[0] = m[0]*mat.m0 + m[0+4]*mat.m1 + m[0+8]*mat.m2 + m[0+12]*mat.m3; 00173 ret.m[1] = m[1]*mat.m0 + m[1+4]*mat.m1 + m[1+8]*mat.m2 + m[1+12]*mat.m3; 00174 ret.m[2] = m[2]*mat.m0 + m[2+4]*mat.m1 + m[2+8]*mat.m2 + m[2+12]*mat.m3; 00175 ret.m[3] = m[3]*mat.m0 + m[3+4]*mat.m1 + m[3+8]*mat.m2 + m[3+12]*mat.m3; 00176 ret.m[0+4] = m[0]*mat.m4 + m[0+4]*mat.m5 + m[0+8]*mat.m6 + m[0+12]*mat.m7; 00177 ret.m[1+4] = m[1]*mat.m4 + m[1+4]*mat.m5 + m[1+8]*mat.m6 + m[1+12]*mat.m7; 00178 ret.m[2+4] = m[2]*mat.m4 + m[2+4]*mat.m5 + m[2+8]*mat.m6 + m[2+12]*mat.m7; 00179 ret.m[3+4] = m[3]*mat.m4 + m[3+4]*mat.m5 + m[3+8]*mat.m6 + m[3+12]*mat.m7; 00180 ret.m[0+8] = m[0]*mat.m8 + m[0+4]*mat.m9 + m[0+8]*mat.m10 + m[0+12]*mat.m11; 00181 ret.m[1+8] = m[1]*mat.m8 + m[1+4]*mat.m9 + m[1+8]*mat.m10 + m[1+12]*mat.m11; 00182 ret.m[2+8] = m[2]*mat.m8 + m[2+4]*mat.m9 + m[2+8]*mat.m10 + m[2+12]*mat.m11; 00183 ret.m[3+8] = m[3]*mat.m8 + m[3+4]*mat.m9 + m[3+8]*mat.m10 + m[3+12]*mat.m11; 00184 ret.m[0+12] = m[0]*mat.m12 + m[0+4]*mat.m13 + m[0+8]*mat.m14 + m[0+12]*mat.m15; 00185 ret.m[1+12] = m[1]*mat.m12 + m[1+4]*mat.m13 + m[1+8]*mat.m14 + m[1+12]*mat.m15; 00186 ret.m[2+12] = m[2]*mat.m12 + m[2+4]*mat.m13 + m[2+8]*mat.m14 + m[2+12]*mat.m15; 00187 ret.m[3+12] = m[3]*mat.m12 + m[3+4]*mat.m13 + m[3+8]*mat.m14 + m[3+12]*mat.m15; 00188 return ret; 00189 }
GLMatrix& mathglpp::GLMatrix< T >::operator *= | ( | const GLMatrix< T > & | mat | ) | [inline] |
Apply the matrix dot product to this matrix.
Definition at line 192 of file GLMatrix.h.
00193 { 00194 GLMatrix temp(*this); 00195 m[0] = temp.m[0]*mat.m0 + temp.m[0+4]*mat.m1 + temp.m[0+8]*mat.m2 + temp.m[0+12]*mat.m3; 00196 m[1] = temp.m[1]*mat.m0 + temp.m[1+4]*mat.m1 + temp.m[1+8]*mat.m2 + temp.m[1+12]*mat.m3; 00197 m[2] = temp.m[2]*mat.m0 + temp.m[2+4]*mat.m1 + temp.m[2+8]*mat.m2 + temp.m[2+12]*mat.m3; 00198 m[3] = temp.m[3]*mat.m0 + temp.m[3+4]*mat.m1 + temp.m[3+8]*mat.m2 + temp.m[3+12]*mat.m3; 00199 m[0+4] = temp.m[0]*mat.m4 + temp.m[0+4]*mat.m5 + temp.m[0+8]*mat.m6 + temp.m[0+12]*mat.m7; 00200 m[1+4] = temp.m[1]*mat.m4 + temp.m[1+4]*mat.m5 + temp.m[1+8]*mat.m6 + temp.m[1+12]*mat.m7; 00201 m[2+4] = temp.m[2]*mat.m4 + temp.m[2+4]*mat.m5 + temp.m[2+8]*mat.m6 + temp.m[2+12]*mat.m7; 00202 m[3+4] = temp.m[3]*mat.m4 + temp.m[3+4]*mat.m5 + temp.m[3+8]*mat.m6 + temp.m[3+12]*mat.m7; 00203 m[0+8] = temp.m[0]*mat.m8 + temp.m[0+4]*mat.m9 + temp.m[0+8]*mat.m10 + temp.m[0+12]*mat.m11; 00204 m[1+8] = temp.m[1]*mat.m8 + temp.m[1+4]*mat.m9 + temp.m[1+8]*mat.m10 + temp.m[1+12]*mat.m11; 00205 m[2+8] = temp.m[2]*mat.m8 + temp.m[2+4]*mat.m9 + temp.m[2+8]*mat.m10 + temp.m[2+12]*mat.m11; 00206 m[3+8] = temp.m[3]*mat.m8 + temp.m[3+4]*mat.m9 + temp.m[3+8]*mat.m10 + temp.m[3+12]*mat.m11; 00207 m[0+12] = temp.m[0]*mat.m12 + temp.m[0+4]*mat.m13 + temp.m[0+8]*mat.m14 + temp.m[0+12]*mat.m15; 00208 m[1+12] = temp.m[1]*mat.m12 + temp.m[1+4]*mat.m13 + temp.m[1+8]*mat.m14 + temp.m[1+12]*mat.m15; 00209 m[2+12] = temp.m[2]*mat.m12 + temp.m[2+4]*mat.m13 + temp.m[2+8]*mat.m14 + temp.m[2+12]*mat.m15; 00210 m[3+12] = temp.m[3]*mat.m12 + temp.m[3+4]*mat.m13 + temp.m[3+8]*mat.m14 + temp.m[3+12]*mat.m15; 00211 return *this; 00212 }
GLMatrix& mathglpp::GLMatrix< T >::mult3by3 | ( | const GLMatrix< T > & | mat | ) | [inline] |
Apply the matrix dot product to this matrix unrolling by sebastien bloc.
Definition at line 216 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::applyRotate(), mathglpp::GLMatrix< value_type >::applyRotateX(), mathglpp::GLMatrix< value_type >::applyRotateXYZ(), mathglpp::GLMatrix< value_type >::applyRotateY(), and mathglpp::GLMatrix< value_type >::applyRotateZ().
00217 { 00218 GLMatrix temp(*this); 00219 m0 = temp.m0*mat.m0+temp.m4*mat.m1+temp.m8*mat.m2; 00220 m4 = temp.m0*mat.m4+temp.m4*mat.m5+temp.m8*mat.m6; 00221 m8 = temp.m0*mat.m8+temp.m4*mat.m9+temp.m8*mat.m10; 00222 m1 = temp.m1*mat.m0+temp.m5*mat.m1+temp.m9*mat.m2; 00223 m5 = temp.m1*mat.m4+temp.m5*mat.m5+temp.m9*mat.m6; 00224 m9 = temp.m1*mat.m8+temp.m5*mat.m9+temp.m9*mat.m10; 00225 m2 = temp.m2*mat.m0+temp.m6*mat.m1+temp.m10*mat.m2; 00226 m6 = temp.m2*mat.m4+temp.m6*mat.m5+temp.m10*mat.m6; 00227 m10 = temp.m2*mat.m8+temp.m6*mat.m9+temp.m10*mat.m10; 00228 m3 = temp.m3*mat.m0+temp.m7*mat.m1+temp.m11*mat.m2; 00229 m7 = temp.m3*mat.m4+temp.m7*mat.m5+temp.m11*mat.m6; 00230 m11 = temp.m3*mat.m8+temp.m7*mat.m9+temp.m11*mat.m10; 00231 return *this; 00232 }
GLVector4<T> mathglpp::GLMatrix< T >::operator * | ( | const GLVector4< T > & | vec | ) | [inline] |
Get the matrix vector dot product, used to transform vertecies.
Definition at line 235 of file GLMatrix.h.
00236 { 00237 GLVector4<T> ret; 00238 ret.val[0] = vec.x * m[0] + vec.y * m[0+4] + vec.z * m[0+8] + vec.w * m[0+12]; 00239 ret.val[1] = vec.x * m[1] + vec.y * m[1+4] + vec.z * m[1+8] + vec.w * m[1+12]; 00240 ret.val[2] = vec.x * m[2] + vec.y * m[2+4] + vec.z * m[2+8] + vec.w * m[2+12]; 00241 ret.val[3] = vec.x * m[3] + vec.y * m[3+4] + vec.z * m[3+8] + vec.w * m[3+12]; 00242 return ret; 00243 }
GLVector3<T> mathglpp::GLMatrix< T >::operator * | ( | const GLVector3< T > & | vec | ) | [inline] |
Get the matrix vector dot product with w = 1, use for transforming non 4D vectors.
Definition at line 246 of file GLMatrix.h.
00247 { 00248 GLVector3<T> ret; 00249 //scale translate and rotate disregarding w scaling 00250 ret[0] = vec[0] * m[0] + vec[1] * m[0+4] + vec[2] * m[0+8] + m[0+12]; 00251 ret[1] = vec[0] * m[1] + vec[1] * m[1+4] + vec[2] * m[1+8] + m[1+12]; 00252 ret[2] = vec[0] * m[2] + vec[1] * m[2+4] + vec[2] * m[2+8] + m[2+12]; 00253 //do w scaling 00254 register T resip = 1 / (vec[0]*m[3] + vec[1]*m[3+4] + vec[2]*m[3+8] + m[3+12]); 00255 ret[0] *= resip; 00256 ret[1] *= resip; 00257 ret[2] *= resip; 00258 return ret; 00259 }
GLVector2<T> mathglpp::GLMatrix< T >::operator * | ( | const GLVector2< T > & | vec | ) | [inline] |
Get the matrix vector dot product with w = 1, use for transforming non 4D vectors.
Definition at line 262 of file GLMatrix.h.
00263 { 00264 GLVector2<T> ret; 00265 ret[0] = vec[0]*m[0] + vec[1]*m[0+4] + m[0+12]; 00266 ret[1] = vec[0]*m[1] + vec[1]*m[1+4] + m[1+12]; 00267 //scale translate and rotate disregarding w scaling 00268 //do w scaling 00269 register T resip = 1/(vec[0]*m[3] + vec[1]*m[3+4] + m[3+12]); 00270 ret[0] *= resip; 00271 ret[1] *= resip; 00272 return ret; 00273 }
GLVector4<T> mathglpp::GLMatrix< T >::operator * | ( | const T *const | v_arr | ) | [inline] |
Get the matrix vector dot4 product, used to transform vertecies.
Definition at line 276 of file GLMatrix.h.
00277 { 00278 GLVector4<T> ret; 00279 ret.val[0] = v_arr[0]*m[0] + v_arr[1]*m[0+4] + v_arr[2]*m[0+8] + v_arr[3]*m[0+12]; 00280 ret.val[1] = v_arr[0]*m[1] + v_arr[1]*m[1+4] + v_arr[2]*m[1+8] + v_arr[3]*m[1+12]; 00281 ret.val[2] = v_arr[0]*m[2] + v_arr[1]*m[2+4] + v_arr[2]*m[2+8] + v_arr[3]*m[2+12]; 00282 ret.val[3] = v_arr[0]*m[3] + v_arr[1]*m[3+4] + v_arr[2]*m[3+8] + v_arr[3]*m[3+12]; 00283 return ret; 00284 }
GLVector2<T> mathglpp::GLMatrix< T >::dot2 | ( | const T *const | v_arr | ) | const [inline] |
Get the matrix vector dot2 product, used to transform non-4D vertecies.
Definition at line 287 of file GLMatrix.h.
00288 { 00289 GLVector2<T> ret; 00290 ret[0] = v_arr[0]*m[0] + v_arr[1]*m[0+4] + m[0+12]; 00291 ret[1] = v_arr[0]*m[1] + v_arr[1]*m[1+4] + m[1+12]; 00292 //scale translate and rotate disregarding w scaling 00293 //do w scaling 00294 register T resip = 1/(v_arr[0]*m[3] + v_arr[1]*m[3+4] + m[3+12]); 00295 ret[0] *= resip; 00296 ret[1] *= resip; 00297 return ret; 00298 }
GLVector2<T> mathglpp::GLMatrix< T >::dot2 | ( | const T | x, | |
const T | y, | |||
const T | w = 1 | |||
) | const [inline] |
Get the matrix vector dot2 product, used to transform non-4D vertecies.
W scale
Definition at line 301 of file GLMatrix.h.
00302 { 00303 GLVector2<T> ret; 00304 ret[0] = x*m[0] + y*m[0+4] + w*m[0+12]; 00305 ret[0] = x*m[0] + y*m[1+4] + w*m[1+12]; 00307 T resip = 1/(x*m[3] + y*m[3+4] + w*m[3+12]); 00308 ret[0] *= resip; 00309 ret[1] *= resip; 00310 return ret; 00311 }
void mathglpp::GLMatrix< T >::vdot2 | ( | T *const | v_arr, | |
const T | w = 1 | |||
) | const [inline] |
Get the matrix vector dot2 product, used to transform non-4D vertecies.
W scale
Definition at line 314 of file GLMatrix.h.
00315 { 00316 const T x = v_arr[0]; 00317 const T y = v_arr[1]; 00318 v_arr[0] = x * m[0] + y * m[0+4] + w * m[0+12]; 00319 v_arr[1] = x * m[1] + y * m[1+4] + w * m[1+12]; 00321 T resip = 1 / (x * m[3] + y * m[3+4] + w * m[3+12]); 00322 v_arr[0] *= resip; 00323 v_arr[1] *= resip; 00324 }
GLVector3<T> mathglpp::GLMatrix< T >::dot3 | ( | const T *const | v_arr | ) | const [inline] |
Get the matrix vector dot3 product, used to transform non-4D vertecies.
Definition at line 327 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::glVertex3(), and mathglpp::GLMatrix< value_type >::glVertex3v().
00328 { 00329 GLVector3<T> ret; 00330 //scale translate and rotate disregarding w scaling 00331 ret[0] = v_arr[0]*m[0] + v_arr[1]*m[0+4] + v_arr[2]*m[0+8] + m[0+12]; 00332 ret[1] = v_arr[0]*m[1] + v_arr[1]*m[1+4] + v_arr[2]*m[1+8] + m[1+12]; 00333 ret[2] = v_arr[0]*m[2] + v_arr[1]*m[2+4] + v_arr[2]*m[2+8] + m[2+12]; 00334 //do w scaling 00335 register T resip = 1/(v_arr[0]*m[3] + v_arr[1]*m[3+4] + v_arr[2]*m[3+8] + m[3+12]); 00336 ret[0] *= resip; 00337 ret[1] *= resip; 00338 ret[2] *= resip; 00339 return ret; 00340 }
GLVector3<T> mathglpp::GLMatrix< T >::dot3 | ( | const T | x, | |
const T | y, | |||
const T | z, | |||
const T | w = 1 | |||
) | const [inline] |
Get the matrix vector dot3 product, used to transform non-4D vertecies.
W scale
Definition at line 343 of file GLMatrix.h.
00344 { 00345 GLVector3<T> ret; 00346 ret[0] = x * m[0] + y * m[0 + 4] + z * m[0 + 8] + w * m[0 + 12]; 00347 ret[1] = x * m[1] + y * m[1 + 4] + z * m[1 + 8] + w * m[1 + 12]; 00348 ret[1] = x * m[2] + y * m[2 + 4] + z * m[2 + 8] + w * m[2 + 12]; 00350 const T resip = 1 / (x * m[3] + y * m[3 + 4] + z * m[3 + 8] + w * m[3 + 12]); 00351 ret[0] *= resip; 00352 ret[1] *= resip; 00353 ret[2] *= resip; 00354 return ret; 00355 }
void mathglpp::GLMatrix< T >::vdot3 | ( | T *const | v_arr, | |
const T | w = 1 | |||
) | const [inline] |
Get the matrix vector dot3 product, used to transform non-4D vertecies.
W scale
Definition at line 358 of file GLMatrix.h.
00359 { 00360 const T x = v_arr[0]; 00361 const T y = v_arr[1]; 00362 const T z = v_arr[2]; 00363 00364 v_arr[0] = x * m[0] + y * m[0 + 4] + z * m[0 + 8] + w * m[0 + 12]; 00365 v_arr[1] = x * m[1] + y * m[1 + 4] + z * m[1 + 8] + w * m[1 + 12]; 00366 v_arr[2] = x * m[2] + y * m[2 + 4] + z * m[2 + 8] + w * m[2 + 12]; 00368 const T resip = 1 / (x * m[3] + y * m[3 + 4] + z * m[3 + 8] + w * m[3 + 12]); 00369 v_arr[0] *= resip; 00370 v_arr[1] *= resip; 00371 v_arr[2] *= resip; 00372 }
GLVector4<T> mathglpp::GLMatrix< T >::dot4 | ( | const T *const | v_arr | ) | const [inline] |
Get the matrix vector dot4 product, used to transform 4D vertecies.
Definition at line 375 of file GLMatrix.h.
Referenced by mathglpp::GLCubicHermiteCurve4< T >::glVertex(), mathglpp::GLMatrix< value_type >::glVertex4(), mathglpp::GLCubicHermiteCurve4< T >::interpolate(), and mathglpp::GLCubicHermiteCurve4< T >::operator()().
00376 { 00377 GLVector4<T> ret; 00378 const T x = v_arr[0]; 00379 const T y = v_arr[1]; 00380 const T z = v_arr[2]; 00381 const T w = v_arr[3]; 00382 00383 //scale translate and rotate disregarding w scaling 00384 ret[0] = x * m[0] + y * m[0 + 4] + z * m[0 + 8] + w * m[0 + 12]; 00385 ret[1] = x * m[1] + y * m[1 + 4] + z * m[1 + 8] + w * m[1 + 12]; 00386 ret[2] = x * m[2] + y * m[2 + 4] + z * m[2 + 8] + w * m[2 + 12]; 00387 ret[3] = x * m[3] + y * m[3 + 4] + z * m[3 + 8] + w * m[3 + 12]; 00388 return ret; 00389 }
void mathglpp::GLMatrix< T >::vdot4 | ( | T *const | v_arr | ) | const [inline] |
Get the matrix vector dot4 product, used to transform 4D vertecies.
Definition at line 392 of file GLMatrix.h.
Referenced by mathglpp::GLCubicHermiteCurve4< T >::interpolate(), mathglpp::CubicBezierCurve4< T >::interpolate(), and mathglpp::GLCubicHermiteCurve4< T >::operator()().
00393 { 00394 const T x = v_arr[0]; 00395 const T y = v_arr[1]; 00396 const T z = v_arr[2]; 00397 const T w = v_arr[3]; 00398 v_arr[0] = x * m[0] + y * m[0 + 4] + z * m[0 + 8] + w * m[0 + 12]; 00399 v_arr[1] = x * m[1] + y * m[1 + 4] + z * m[1 + 8] + w * m[1 + 12]; 00400 v_arr[2] = x * m[2] + y * m[2 + 4] + z * m[2 + 8] + w * m[2 + 12]; 00401 v_arr[3] = x * m[3] + y * m[3 + 4] + z * m[3 + 8] + w * m[3 + 12]; 00402 }
GLVector4<T> mathglpp::GLMatrix< T >::dot4 | ( | const T | x, | |
const T | y, | |||
const T | z, | |||
const T | w | |||
) | [inline] |
Get the matrix vector dot4 product, used to transform 4D vertecies.
Definition at line 405 of file GLMatrix.h.
00406 { 00407 GLVector4<T> ret; 00408 ret.val[0] = x * m[0] + y * m[0+4] + z * m[0+8] + w * m[0+12]; 00409 ret.val[1] = x * m[1] + y * m[1+4] + z * m[1+8] + w * m[1+12]; 00410 ret.val[2] = x * m[2] + y * m[2+4] + z * m[2+8] + w * m[2+12]; 00411 ret.val[3] = x * m[3] + y * m[3+4] + z * m[3+8] + w * m[3+12]; 00412 return ret; 00413 }
void mathglpp::GLMatrix< T >::glVertex3v | ( | const T *const | v_arr | ) | [inline] |
Transform the vertex and send it to OpenGL.
Definition at line 416 of file GLMatrix.h.
00417 { 00418 (this->dot3(v_arr)).glVertex(); 00419 }
void mathglpp::GLMatrix< T >::glVertex3 | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [inline] |
Transform the vertex and send it to OpenGL.
Definition at line 422 of file GLMatrix.h.
00423 { 00424 (this->dot3(x,y,z)).glVertex(); 00425 }
void mathglpp::GLMatrix< T >::glVertex4v | ( | const T *const | v_arr | ) | [inline] |
Transform the vertex and send it to OpenGL.
Definition at line 428 of file GLMatrix.h.
00429 { 00430 (this->operator *(v_arr)).glVertex(); 00431 }
void mathglpp::GLMatrix< T >::glVertex4 | ( | const T | x, | |
const T | y, | |||
const T | z, | |||
const T | w | |||
) | [inline] |
Transform the vertex and send it to OpenGL.
Definition at line 434 of file GLMatrix.h.
00435 { 00436 (this->dot4(x,y,z,w)).glVertex(); 00437 }
void mathglpp::GLMatrix< T >::glVertex3v | ( | const int | num, | |
const T *const | v_arr | |||
) |
Transform a run of vertecies and send them to OpenGL.
void mathglpp::GLMatrix< T >::glVertex4v | ( | const int | num, | |
const T *const | v_arr | |||
) |
Transform a run of vertecies and send them to OpenGL.
void mathglpp::GLMatrix< T >::glMultMatrix | ( | void | ) | [inline] |
GL interface, glMultMatrix.
Definition at line 446 of file GLMatrix.h.
00446 { mathglpp::glMultMatrix<T>(m); };
void mathglpp::GLMatrix< T >::glLoadMatrix | ( | void | ) | [inline] |
GL interface, glLoadMatrix.
Definition at line 448 of file GLMatrix.h.
00448 { mathglpp::glLoadMatrix<T>(m); };
void mathglpp::GLMatrix< T >::glGet | ( | const GLenum | pname | ) | [inline] |
GL interface, glGet, gets a matrix from OpenGL.
Definition at line 450 of file GLMatrix.h.
00450 { mathglpp::glGet<T>(pname,m); };
GLMatrix& mathglpp::GLMatrix< T >::transpose | ( | void | ) | [inline] |
GLMatrix mathglpp::GLMatrix< T >::getTranspose | ( | void | ) | [inline] |
static GLMatrix mathglpp::GLMatrix< T >::identity | ( | void | ) | [inline, static] |
Special glMatricies Identity matrix.
Definition at line 469 of file GLMatrix.h.
00470 { 00471 GLMatrix ret; 00472 00473 ret.m0 = 1; ret.m4 = 0; ret.m8 = 0; ret.m12 = 0; 00474 ret.m1 = 0; ret.m5 = 1; ret.m9 = 0; ret.m13 = 0; 00475 ret.m2 = 0; ret.m6 = 0; ret.m10 = 1; ret.m14 = 0; 00476 ret.m3 = 0; ret.m7 = 0; ret.m11 = 0; ret.m15 = 1; 00477 00478 return ret; 00479 }
GLMatrix& mathglpp::GLMatrix< T >::loadIdentity | ( | void | ) | [inline] |
static GLMatrix mathglpp::GLMatrix< T >::zero | ( | void | ) | [inline, static] |
GLMatrix& mathglpp::GLMatrix< T >::loadZero | ( | void | ) | [inline] |
static GLMatrix mathglpp::GLMatrix< T >::glRotate | ( | const T | angle, | |
T | x, | |||
T | y, | |||
T | z | |||
) | [static] |
OpenGL rotation matrix.
GLMatrix& mathglpp::GLMatrix< T >::loadRotate | ( | const T | angle, | |
T | x, | |||
T | y, | |||
T | z | |||
) | [inline] |
Make this an OpenGL rotation matrix.
Definition at line 513 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::applyRotate().
00514 { 00515 register T magSqr = x*x + y*y + z*z; 00516 if(magSqr != 1.0) 00517 { 00518 const T mag = sqrt(magSqr); 00519 x /= mag; 00520 y /= mag; 00521 z /= mag; 00522 } 00523 const T c = T(cos(angle * M_PI / 180)); 00524 const T s = T(sin(angle * M_PI / 180)); 00525 m0 = x*x*(1-c)+c; 00526 m1 = y*x*(1-c)+z*s; 00527 m2 = z*x*(1-c)-y*s; 00528 m3 = 0; 00529 00530 m4 = x*y*(1-c)-z*s; 00531 m5 = y*y*(1-c)+c; 00532 m6 = z*y*(1-c)+x*s; 00533 m7 = 0; 00534 00535 m8 = x*z*(1-c)+y*s; 00536 m9 = y*z*(1-c)-x*s; 00537 m10 = z*z*(1-c)+c; 00538 m11 = 0; 00539 00540 m12 = 0; 00541 m13 = 0; 00542 m14 = 0; 00543 m15 = 1; 00544 00545 return *this; 00546 }
GLMatrix& mathglpp::GLMatrix< T >::loadRotateX | ( | const T | angle | ) | [inline] |
Load rotate[X,Y,Z,XYZ] specialisations by sebastien bloc Make this an OpenGL rotation matrix: same as loadRotate(angle,1,0,0).
Definition at line 550 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::applyRotateX(), and mathglpp::GLMatrix< value_type >::applyRotateXYZ().
00551 { 00552 const T c = T(cos(angle * M_PI / 180)); 00553 const T s = T(sin(angle * M_PI / 180)); 00554 m0 = 1; 00555 m1 = 0; 00556 m2 = 0; 00557 m3 = 0; 00558 00559 m4 = 0; 00560 m5 = c; 00561 m6 = s; 00562 m7 = 0; 00563 00564 m8 = 0; 00565 m9 = -s; 00566 m10 = c; 00567 m11 = 0; 00568 00569 m12 = 0; 00570 m13 = 0; 00571 m14 = 0; 00572 m15 = 1; 00573 00574 return *this; 00575 }
GLMatrix& mathglpp::GLMatrix< T >::loadRotateY | ( | const T | angle | ) | [inline] |
Make this an OpenGL rotation matri0: same as loadRotate(angle,0,1,0).
Definition at line 578 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::applyRotateXYZ(), and mathglpp::GLMatrix< value_type >::applyRotateY().
00579 { 00580 const T c = T(cos(angle * M_PI / 180)); 00581 const T s = T(sin(angle * M_PI / 180)); 00582 m0 = c; 00583 m1 = 0; 00584 m2 = -s; 00585 m3 = 0; 00586 00587 m4 = 0; 00588 m5 = 1; 00589 m6 = 0; 00590 m7 = 0; 00591 00592 m8 = s; 00593 m9 = 0; 00594 m10 = c; 00595 m11 = 0; 00596 00597 m12 = 0; 00598 m13 = 0; 00599 m14 = 0; 00600 m15 = 1; 00601 00602 return *this; 00603 }
GLMatrix& mathglpp::GLMatrix< T >::loadRotateZ | ( | const T | angle | ) | [inline] |
Make this an OpenGL rotation matrix: same as loadRotateZ(angle,0,0,1).
Definition at line 606 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::applyRotateXYZ(), and mathglpp::GLMatrix< value_type >::applyRotateZ().
00607 { 00608 const T c = T(cos(angle * M_PI / 180)); 00609 const T s = T(sin(angle * M_PI / 180)); 00610 m0 = c; 00611 m1 = s; 00612 m2 = 0; 00613 m3 = 0; 00614 00615 m4 = -s; 00616 m5 = c; 00617 m6 = 0; 00618 m7 = 0; 00619 00620 m8 = 0; 00621 m9 = 0; 00622 m10 = 1; 00623 m11 = 0; 00624 00625 m12 = 0; 00626 m13 = 0; 00627 m14 = 0; 00628 m15 = 1; 00629 00630 return *this; 00631 }
GLMatrix& mathglpp::GLMatrix< T >::applyRotate | ( | const T | angle, | |
const T | x, | |||
const T | y, | |||
const T | z | |||
) | [inline] |
Apply an OpenGL rotation matrix to this.
Definition at line 634 of file GLMatrix.h.
00635 { 00636 static GLMatrix temp; 00637 temp.loadRotate(angle, x, y, z); 00638 return mult3by3(temp); 00639 }
GLMatrix& mathglpp::GLMatrix< T >::applyRotateX | ( | const T | angle | ) | [inline] |
Apply rotate[X,Y,Z,XYZ] specialisations by sebastien bloc Apply an OpenGL rotation matrix to this.
Definition at line 643 of file GLMatrix.h.
00644 { 00645 static GLMatrix temp; 00646 temp.loadRotateX(angle); 00647 return mult3by3(temp); 00648 }
GLMatrix& mathglpp::GLMatrix< T >::applyRotateY | ( | const T | angle | ) | [inline] |
Apply an OpenGL rotation matrix to this.
Definition at line 651 of file GLMatrix.h.
00652 { 00653 static GLMatrix temp; 00654 temp.loadRotateY(angle); 00655 return mult3by3(temp); 00656 }
GLMatrix& mathglpp::GLMatrix< T >::applyRotateZ | ( | const T | angle | ) | [inline] |
Apply an OpenGL rotation matrix to this.
Definition at line 659 of file GLMatrix.h.
00660 { 00661 static GLMatrix temp; 00662 temp.loadRotateZ(angle); 00663 return mult3by3(temp); 00664 }
GLMatrix& mathglpp::GLMatrix< T >::applyRotateXYZ | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [inline] |
static GLMatrix mathglpp::GLMatrix< T >::glScale | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [inline, static] |
OpenGL scale matrix.
Definition at line 679 of file GLMatrix.h.
00680 { 00681 GLMatrix ret; 00682 ret.m0 = x; ret.m4 = 0; ret.m8 = 0; ret.m12 = 0; 00683 ret.m1 = 0; ret.m5 = y; ret.m9 = 0; ret.m13 = 0; 00684 ret.m2 = 0; ret.m6 = 0; ret.m10 = z; ret.m14 = 0; 00685 ret.m3 = 0; ret.m7 = 0; ret.m11 = 0; ret.m15 = 1; 00686 return ret; 00687 }
GLMatrix& mathglpp::GLMatrix< T >::loadScale | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyScale | ( | const T | x, | |
const T | y | |||
) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyScale | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyScale | ( | const GLVector2< T > & | scale | ) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyScale | ( | const GLVector3< T > & | scale | ) | [inline] |
Apply an OpenGL scale matrix to this.
Definition at line 730 of file GLMatrix.h.
00731 { 00732 /*improved version*/ 00733 m0 *= scale.x; m1 *= scale.x; m2 *= scale.x; m3 *= scale.x; 00734 m4 *= scale.y; m5 *= scale.y; m6 *= scale.y; m7 *= scale.y; 00735 m8 *= scale.z; m9 *= scale.z; m10 *= scale.z; m11 *= scale.z; 00736 return *this; 00737 }
static GLMatrix mathglpp::GLMatrix< T >::glTranslate | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [static] |
OpenGL translate matrix.
GLMatrix& mathglpp::GLMatrix< T >::loadTranslate | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyTranslate | ( | const T | x, | |
const T | y | |||
) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyTranslate | ( | const T | x, | |
const T | y, | |||
const T | z | |||
) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyTranslate | ( | const GLVector2< T > & | trans | ) | [inline] |
GLMatrix& mathglpp::GLMatrix< T >::applyTranslate | ( | const GLVector3< T > & | trans | ) | [inline] |
Apply an OpenGL translate matrix to this.
Definition at line 785 of file GLMatrix.h.
00786 { 00787 /*improved version*/ 00788 m12 += m0 * trans.x + m4 * trans.y + m8 * trans.z; 00789 m13 += m1 * trans.x + m5 * trans.y + m9 * trans.z; 00790 m14 += m2 * trans.x + m6 * trans.y + m10 * trans.z; 00791 return *this; 00792 }
static GLMatrix mathglpp::GLMatrix< T >::glFrustum | ( | const GLdouble | left, | |
const GLdouble | right, | |||
const GLdouble | bottom, | |||
const GLdouble | top, | |||
const GLdouble | zNear, | |||
const GLdouble | zFar | |||
) | [inline, static] |
OpenGL frustum matrix.
Definition at line 796 of file GLMatrix.h.
00799 { 00800 GLMatrix ret; 00801 ret.m0 = T(2 * zNear / (right - left)); 00802 ret.m1 = 0; 00803 ret.m2 = 0; 00804 ret.m3 = 0; 00805 00806 ret.m4 = 0; 00807 ret.m5 = T(2 * zNear / (top - bottom)); 00808 ret.m6 = 0; 00809 ret.m7 = 0; 00810 00811 ret.m8 = T((right + left) / (right - left)); 00812 ret.m9 = T((top + bottom) / (top - bottom)); 00813 ret.m10 = -T((zFar + zNear) / (zFar - zNear)); 00814 ret.m11 = -1; 00815 00816 ret.m12 = 0; 00817 ret.m13 = 0; 00818 ret.m14 = -T(2 * zFar * zNear / (zFar - zNear)); 00819 ret.m15 = 0; 00820 00821 return ret; 00822 }
GLMatrix& mathglpp::GLMatrix< T >::loadFrustum | ( | const GLdouble | left, | |
const GLdouble | right, | |||
const GLdouble | bottom, | |||
const GLdouble | top, | |||
const GLdouble | zNear, | |||
const GLdouble | zFar | |||
) | [inline] |
Make this with an OpenGL frustum matrix.
Definition at line 826 of file GLMatrix.h.
00829 { 00830 m0 = T(2 * zNear / (right-left)); 00831 m1 = 0; 00832 m2 = 0; 00833 m3 = 0; 00834 00835 m4 = 0; 00836 m5 = T(2 * zNear / (top-bottom)); 00837 m6 = 0; 00838 m7 = 0; 00839 00840 m8 = T((right + left) / (right - left)); 00841 m9 = T((top + bottom) / (top - bottom)); 00842 m10 = -T((zFar + zNear) / (zFar - zNear)); 00843 m11 = -1; 00844 00845 m12 = 0; 00846 m13 = 0; 00847 m14 = T(-2 * zFar * zNear / (zFar - zNear)); 00848 m15 = 0; 00849 00850 return *this; 00851 }
static GLMatrix mathglpp::GLMatrix< T >::glOrtho | ( | const GLdouble | left, | |
const GLdouble | right, | |||
const GLdouble | bottom, | |||
const GLdouble | top, | |||
const GLdouble | zNear, | |||
const GLdouble | zFar | |||
) | [inline, static] |
OpenGL orthogonal matrix.
Definition at line 854 of file GLMatrix.h.
00857 { 00858 GLMatrix ret; 00859 ret.m0 = T(2 / (right - left)); 00860 ret.m1 = 0; 00861 ret.m2 = 0; 00862 ret.m3 = 0; 00863 00864 ret.m4 = 0; 00865 ret.m5 = T(2 / (top - bottom)); 00866 ret.m6 = 0; 00867 ret.m7 = 0; 00868 00869 ret.m8 = 0; 00870 ret.m9 = 0; 00871 ret.m10 = T(-2 / (zFar - zNear)); 00872 ret.m11 = 0; 00873 00874 ret.m12 = -T((right + left) / (right - left)); 00875 ret.m13 = -T((top + bottom) / (top - bottom)); 00876 ret.m14 = -T((zFar + zNear) / (zFar - zNear)); 00877 ret.m15 = 1; 00878 00879 return ret; 00880 }
GLMatrix& mathglpp::GLMatrix< T >::loadOrtho | ( | const GLdouble | left, | |
const GLdouble | right, | |||
const GLdouble | bottom, | |||
const GLdouble | top, | |||
const GLdouble | zNear, | |||
const GLdouble | zFar | |||
) | [inline] |
OpenGL orthogonal matrix.
Definition at line 883 of file GLMatrix.h.
00886 { 00887 m0 = T(2 / (right - left)); 00888 m1 = 0; 00889 m2 = 0; 00890 m3 = 0; 00891 00892 m4 = 0; 00893 m5 = T(2 / (top - bottom)); 00894 m6 = 0; 00895 m7 = 0; 00896 00897 m8 = 0; 00898 m9 = 0; 00899 m10 = -T(2 / (zFar - zNear)); 00900 m11 = 0; 00901 00902 m12 = -T((right + left) / (right - left)); 00903 m13 = -T((top + bottom) / (top - bottom)); 00904 m14 = -T((zFar + zNear) / (zFar - zNear)); 00905 m15 = 1; 00906 00907 return *this; 00908 }
GLMatrix& mathglpp::GLMatrix< T >::loadView | ( | const T | fx, | |
const T | fy, | |||
const T | fz, | |||
const T | ux, | |||
const T | uy, | |||
const T | uz, | |||
const T | sx, | |||
const T | sy, | |||
const T | sz | |||
) | [inline] |
OpenGL View Matrix.
Definition at line 911 of file GLMatrix.h.
00914 { 00915 m0 = sx; 00916 m1 = ux; 00917 m2 = -fx; 00918 m3 = 0; 00919 00920 m4 = sy; 00921 m5 = uy; 00922 m6 = -fy; 00923 m7 = 0; 00924 00925 m8 = sz; 00926 m9 = uz; 00927 m10 = -fz; 00928 m11 = 0; 00929 00930 m12 = 0; 00931 m13 = 0; 00932 m14 = 0; 00933 m15 = 1; 00934 00935 return *this; 00936 }
GLMatrix& mathglpp::GLMatrix< T >::loadView | ( | const T *const | f, | |
const T *const | u, | |||
const T *const | s | |||
) | [inline] |
OpenGL View Matrix.
Definition at line 939 of file GLMatrix.h.
00940 { 00941 m0 = s[0]; 00942 m1 = u[0]; 00943 m2 = -f[0]; 00944 m3 = 0; 00945 00946 m4 = s[1]; 00947 m5 = u[1]; 00948 m6 = -f[1]; 00949 m7 = 0; 00950 00951 m8 = s[2]; 00952 m9 = u[2]; 00953 m10 = -f[2]; 00954 m11 = 0; 00955 00956 m12 = 0; 00957 m13 = 0; 00958 m14 = 0; 00959 m15 = 1; 00960 00961 return *this; 00962 }
GLMatrix& mathglpp::GLMatrix< T >::loadView | ( | const GLVector3< T > & | front, | |
const GLVector3< T > & | up, | |||
const GLVector3< T > | side | |||
) | [inline] |
OpenGL View Matrix.
Definition at line 965 of file GLMatrix.h.
00966 { 00967 m0 = side.x; 00968 m1 = up.x; 00969 m2 = -front.x; 00970 m3 = 0; 00971 00972 m4 = side.y; 00973 m5 = up.y; 00974 m6 = -front.y; 00975 m7 = 0; 00976 00977 m8 = side.z; 00978 m9 = up.z; 00979 m10 = -front.z; 00980 m11 = 0; 00981 00982 m12 = 0; 00983 m13 = 0; 00984 m14 = 0; 00985 m15 = 1; 00986 00987 return *this; 00988 }
const T mathglpp::GLMatrix< T >::cofactorm0 | ( | ) | const [inline, protected] |
Cofactor of m0.
Definition at line 1046 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::adjoint(), and mathglpp::GLMatrix< value_type >::det().
const T mathglpp::GLMatrix< T >::cofactorm1 | ( | ) | const [inline, protected] |
Cofactor of m1.
Definition at line 1048 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::adjoint(), and mathglpp::GLMatrix< value_type >::det().
const T mathglpp::GLMatrix< T >::cofactorm2 | ( | ) | const [inline, protected] |
Cofactor of m2.
Definition at line 1050 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::adjoint(), and mathglpp::GLMatrix< value_type >::det().
const T mathglpp::GLMatrix< T >::cofactorm3 | ( | ) | const [inline, protected] |
Cofactor of m3.
Definition at line 1052 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::adjoint(), and mathglpp::GLMatrix< value_type >::det().
const T mathglpp::GLMatrix< T >::cofactorm4 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm5 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm6 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm7 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm8 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm9 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm10 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm11 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm12 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm13 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm14 | ( | ) | const [inline, protected] |
const T mathglpp::GLMatrix< T >::cofactorm15 | ( | ) | const [inline, protected] |
T mathglpp::GLMatrix< T >::m[16] |
Straight column major vector layout.
Definition at line 1087 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::dot2(), mathglpp::GLMatrix< value_type >::dot3(), mathglpp::GLMatrix< value_type >::dot4(), mathglpp::GLMatrix< value_type >::glGet(), mathglpp::GLMatrix< value_type >::glLoadMatrix(), mathglpp::GLMatrix< value_type >::GLMatrix(), mathglpp::GLMatrix< value_type >::glMultMatrix(), mathglpp::GLMatrix< T >::glVertex3v(), mathglpp::GLMatrix< T >::glVertex4v(), mathglpp::GLMatrix< value_type >::operator *(), mathglpp::GLMatrix< value_type >::operator *=(), mathglpp::GLMatrix< value_type >::operator const value_type *(), mathglpp::GLMatrix< value_type >::operator value_type *(), mathglpp::GLMatrix< value_type >::operator+=(), mathglpp::GLMatrix< value_type >::operator-=(), mathglpp::GLMatrix< value_type >::operator/=(), mathglpp::GLMatrix< value_type >::operator=(), mathglpp::GLMatrix< value_type >::operator==(), mathglpp::GLMatrix< value_type >::operator[](), mathglpp::GLMatrix< value_type >::vdot2(), mathglpp::GLMatrix< value_type >::vdot3(), and mathglpp::GLMatrix< value_type >::vdot4().
T mathglpp::GLMatrix< T >::m_c_r[4][4] |
T mathglpp::GLMatrix< T >::m0 |
Fast individual element access.
Definition at line 1093 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::applyScale(), mathglpp::GLMatrix< value_type >::applyTranslate(), mathglpp::GLMatrix< value_type >::cofactorm10(), mathglpp::GLMatrix< value_type >::cofactorm11(), mathglpp::GLMatrix< value_type >::cofactorm14(), mathglpp::GLMatrix< value_type >::cofactorm15(), mathglpp::GLMatrix< value_type >::cofactorm5(), mathglpp::GLMatrix< value_type >::cofactorm6(), mathglpp::GLMatrix< value_type >::cofactorm7(), mathglpp::GLMatrix< value_type >::cofactorm9(), mathglpp::GLMatrix< value_type >::det(), mathglpp::GLMatrix< value_type >::GLMatrix(), mathglpp::GLMatrix< value_type >::glOrtho(), mathglpp::GLMatrix< T >::glRotate(), mathglpp::GLMatrix< value_type >::glScale(), mathglpp::GLMatrix< T >::glTranslate(), mathglpp::GLMatrix< T >::glVertex3v(), mathglpp::GLMatrix< value_type >::identity(), mathglpp::GLMatrix< value_type >::inverse(), mathglpp::GLMatrix< value_type >::loadFrustum(), mathglpp::GLMatrix< value_type >::loadIdentity(), mathglpp::GLMatrix< value_type >::loadOrtho(), mathglpp::GLMatrix< value_type >::loadRotate(), mathglpp::GLMatrix< value_type >::loadRotateX(), mathglpp::GLMatrix< value_type >::loadRotateY(), mathglpp::GLMatrix< value_type >::loadRotateZ(), mathglpp::GLMatrix< value_type >::loadScale(), mathglpp::GLMatrix< value_type >::loadTranslate(), mathglpp::GLMatrix< value_type >::loadView(), mathglpp::GLMatrix< value_type >::loadZero(), mathglpp::GLMatrix< value_type >::mult3by3(), mathglpp::GLMatrix< value_type >::operator *(), and mathglpp::GLMatrix< value_type >::operator *=().
T mathglpp::GLMatrix< T >::_a |
Fast individual element access.
Definition at line 1098 of file GLMatrix.h.
Referenced by mathglpp::GLMatrix< value_type >::eigenValues().