TuttleOFX  1
MatrixManipulation.hpp
Go to the documentation of this file.
00001 #ifndef MATRIXMANIPULATION_HPP
00002 #define MATRIXMANIPULATION_HPP
00003 
00004 #include <ofxCore.h>
00005 #include <math.h>
00006 #include <boost/array.hpp>
00007 
00008 namespace tuttle {
00009 namespace plugin {
00010 namespace colorCubeViewer {
00011 
00012 //declare boost::array as Types
00013 typedef boost::array<double,16> Matrix4;        //4*4 matrix
00014 typedef boost::array<double,4>  Vect4;          //4 vector
00015 typedef boost::array<double,3>  Axis;           //axis X = (1,0,0)    Y = (0,1,0)   Z = (0,0,1) or others
00016 
00017 //Matrix product with a 3D vector and a 4*4 matrix 
00018 void productVectorMatrix(const Vect4& v, const Matrix4& m, Vect4& result);
00019 
00020 //Does the multiplication A=A*B : all the matrices are 4*4 and described column-major
00021 void multMatrixBtoMatrixA(Matrix4& A, const Matrix4& B);
00022 
00023 //Sets the provided matrix to identity
00024 void setToIdentity(Matrix4& matrix);
00025 
00026 //Sets the provided matrix to a rotate matrix of angle "angle", around axis "axis"
00027 void setToRotate( Matrix4& matrix, const double& angle, const Axis axis );
00028 
00029 //Sets the provided matrix to a translate matrix on vector t
00030 void setToTranslate(Matrix4& matrix, const Vect4& t);
00031 
00032 //Create rotation matrix with rotation center (translate + rotate + inverse translate)
00033 Matrix4 constructRotationMatrix(const Ofx3DPointD& rotationCenter, const double& angleX, const double& angleY, const double& angleZ);
00034 
00035 }
00036 }
00037 }
00038 #endif
00039