ModelMaths.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(__INCLUDE_ModelMathsh_INCLUDE__)
00022 #define __INCLUDE_ModelMathsh_INCLUDE__
00023 
00024 #include <common/Vector.h>
00025 
00026 class ModelMaths
00027 {
00028 public:
00029         static void angleQuaternion(const Vector &angles, 
00030                 float quaternion[4]);
00031         static void quaternionSlerp(float p[4], 
00032                 float q[4], float t, float qt[4]);
00033 
00034         static void angleMatrix(
00035                 const Vector &angles, float matrix[3][4]);
00036         static void quaternionMatrix(
00037                 float quaternion[4], float matrix[3][4]);
00038 
00039         static void concatTransforms(const float in1[3][4],
00040                 const float in2[3][4], float out[3][4]);
00041         static void vectorIRotate(const Vector &in1, 
00042                 const float in2[3][4], Vector &out);
00043         static float dotProduct(const Vector &v1, 
00044                 const Vector &v2)
00045         {
00046                 return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
00047         }
00048         static void vectorRotate(const Vector &in1, 
00049                 const float in2[3][4], Vector &out)
00050         {
00051                 out[0] = dotProduct(in1, in2[0]);
00052                 out[1] = dotProduct(in1, in2[1]);
00053                 out[2] = dotProduct(in1, in2[2]);
00054         }
00055 
00056 private:
00057         ModelMaths();
00058 };
00059 
00060 #endif // __INCLUDE_ModelMathsh_INCLUDE__

Generated on Mon Feb 16 15:14:48 2009 for Scorched3D by  doxygen 1.5.3