|
solver.h00001 /* 00002 Dynamics/Kinematics modeling and simulation library. 00003 Copyright (C) 1999 by Michael Alexander Ewert 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 00019 */ 00020 00021 #ifndef __CT_SOLVER_H__ 00022 #define __CT_SOLVER_H__ 00023 00024 #include "csphyzik/phyztype.h" 00025 #include "csphyzik/ctvector.h" 00026 00028 00029 class ctDynamicEntity; 00030 00031 // abstract classes 00032 00039 class ctSolver 00040 { 00041 public: 00042 virtual void solve ( real t ) = 0; 00043 virtual void init () {}; 00044 00045 }; 00046 00047 00049 class ctSimpleDynamicsSolver : public ctSolver 00050 { 00051 public: 00052 ctSimpleDynamicsSolver ( ctDynamicEntity &pde ) 00053 : de( pde ) {}; 00054 virtual void solve ( real t ); 00055 00056 protected: 00058 ctDynamicEntity &de; 00059 00060 }; 00061 00063 class ctArticulatedSolver : public ctSolver 00064 { 00065 public: 00067 virtual ctVector3 get_linear_a () = 0; 00068 virtual ctVector3 get_angular_a () = 0; 00069 virtual void apply_impulse ( ctVector3 impulse_point, 00070 ctVector3 impulse_vector ) = 0; 00071 00072 virtual void get_impulse_m_and_I_inv ( real *pm, ctMatrix3 *pI_inv, 00073 const ctVector3 &impulse_point, 00074 const ctVector3 &unit_length_impulse_vector ) = 0; 00075 00076 }; 00077 00078 00080 class ctGoalSolver : public ctSolver 00081 { 00082 public: 00083 void set_goal ( const ctVector3 &pgoal ){ goal = pgoal; } 00084 00085 protected: 00086 ctVector3 goal; 00087 00088 }; 00089 00091 class ctArticulatedGoalSolver : public ctArticulatedSolver 00092 { 00093 public: 00094 void set_goal ( const ctVector3 &pgoal ){ goal = pgoal; } 00095 00096 protected: 00097 ctVector3 goal; 00098 }; 00099 00100 #endif // __CT_SOLVER_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |