GEL  2
GEL is a library for Geometry and Linear Algebra
/Users/jab/Documents/Teaching/02585/GEL2_and_demos/GEL/src/CGLA/Mat4x4f.h
00001 #ifndef __CGLA_MAT4X4_H__
00002 #define __CGLA_MAT4X4_H__
00003 
00004 #include "ExceptionStandard.h"
00005 #include "CGLA.h"
00006 #include "Vec3f.h"
00007 #include "Vec3Hf.h"
00008 #include "Vec4f.h"
00009 #include "ArithSqMat4x4Float.h"
00010 
00011 
00012 namespace CGLA 
00013 {
00014 
00018   class Mat4x4f: public ArithSqMat4x4Float<Vec4f, Mat4x4f>
00019     {
00020     public:
00021   
00023       Mat4x4f(Vec4f _a, Vec4f _b, Vec4f _c, Vec4f _d): 
00024         ArithSqMat4x4Float<Vec4f, Mat4x4f> (_a,_b,_c,_d) {}
00025   
00027       Mat4x4f() {}
00028 
00030       explicit Mat4x4f(float a) : ArithSqMat4x4Float<Vec4f, Mat4x4f> (a) {}
00031     };
00032 
00034   Mat4x4f rotation_Mat4x4f(CGLA::Axis axis, float angle);
00035 
00037   Mat4x4f translation_Mat4x4f(const Vec3f&);
00038 
00040   Mat4x4f scaling_Mat4x4f(const Vec3f&);
00041 
00043   inline Mat4x4f identity_Mat4x4f()
00044     {
00045       return Mat4x4f(Vec4f(1,0,0,0), 
00046                      Vec4f(0,1,0,0), 
00047                      Vec4f(0,0,1,0), 
00048                      Vec4f(0,0,0,1));
00049     }
00050 
00055   inline Mat4x4f invert_ortho(const Mat4x4f& m)
00056   {
00057     Vec3f rx(m[0][0], m[1][0], m[2][0]);
00058     Vec3f ry(m[0][1], m[1][1], m[2][1]);
00059     Vec3f rz(m[0][2], m[1][2], m[2][2]);
00060     Vec3f t(m[0][3], m[1][3], m[2][3]);
00061 
00062     return Mat4x4f(Vec4f(rx, -dot(t, rx)),
00063                    Vec4f(ry, -dot(t, ry)),
00064                    Vec4f(rz, -dot(t, rz)),
00065                    Vec4f(0.0, 0.0, 0.0, 1.0));
00066   }   
00067 }
00068 #endif
00069 
00070 
00071 
00072 
00073 
00074 
00075 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations