MirtichRestitutionModel.h

00001 /****************************************************************************
00002  * Copyright 2006 Evan Drumwright
00003  * This library is distributed under the terms of the GNU General Public 
00004  * License (found in COPYING).
00005  ****************************************************************************/
00006 
00007 #ifndef _MIRTICH_RESTITUTION_MODEL_H
00008 #define _MIRTICH_RESTITUTION_MODEL_H
00009 
00010 #include <Physsim/Vector3.h>
00011 #include <Physsim/Matrix3.h>
00012 #include <Physsim/CollisionMethod.h>
00013 
00014 namespace Physsim {
00015 
00017 
00029 class MirtichRestitutionModel : public CollisionMethod
00030 {
00031         public:
00033                 MirtichRestitutionModel() { _step_size = .001; _max_iterations = DEFAULT_MAX_ITERATIONS; }
00034                 
00036                 MirtichRestitutionModel(Real step_size) { _step_size = step_size; }
00037 
00038                 virtual void load_state(BaseConstPtr object, bimap<BasePtr, BasePtr>* correspondence = NULL);
00039                 virtual void save_state(BasePtr object, bimap<BasePtr, BasePtr>* correspondence = NULL) const;
00040                 virtual void clone(BasePtr& cloned, bimap<BasePtr, BasePtr>* object_map = NULL) const;
00041                 virtual void process_impacts(const std::list<ContactPtr >& contacts) const;
00042                 virtual void load_from_xml(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00043                 virtual void save_to_xml(XMLTreePtr node, std::list<BaseConstPtr>& shared_objects) const;
00044                 virtual bool is_global_method() const { return false; }
00045 
00047                 void set_step_size(Real step_size) { assert(step_size > 0); _step_size = step_size; }
00048 
00050                 Real get_step_size() const { return _step_size; }
00051 
00052         private:
00053                 void process_impact(ContactPtr c) const;
00054                 static VectorN ode_ux_uy_Wz_wrt_uz(const VectorN& state, Real uz, void* data);
00055                 static VectorN ode_ux_uy_uz_wrt_Wz(const VectorN& state, Real uz, void* data);
00056                 static Real det_theta(const Matrix3& K, Real theta);
00057                 static const unsigned DEFAULT_MAX_ITERATIONS = 1;
00058 
00060 
00064                 Real _step_size;
00065 
00067                 unsigned _max_iterations;
00068 }; // end class
00069 } // end namespace
00070 
00071 #endif

Generated on Wed Oct 24 14:54:21 2007 for Physsim by  doxygen 1.5.1