00001
00002
00003
00004
00005
00006
00007 #ifndef _NEWTON_RESTITUTION_MODEL_H
00008 #define _NEWTON_RESTITUTION_MODEL_H
00009
00010 #include <Physsim/CollisionMethod.h>
00011
00012 namespace Physsim {
00013
00015
00026 class NewtonRestitutionModel : public CollisionMethod
00027 {
00028 public:
00029 NewtonRestitutionModel() { _max_iterations = DEFAULT_MAX_ITERATIONS; }
00030 virtual void process_impacts(const std::list<ContactPtr >& contacts) const;
00031 void load_state(BaseConstPtr object, bimap<BasePtr, BasePtr>* correspondence);
00032 void save_state(BasePtr object, bimap<BasePtr, BasePtr>* correspondence = NULL) const;
00033 virtual void clone(BasePtr& cloned, bimap<BasePtr, BasePtr>* object_map = NULL) const;
00034 virtual void load_from_xml(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00035 virtual void save_to_xml(XMLTreePtr node, std::list<BaseConstPtr>& shared_objects) const;
00036 virtual bool is_global_method() const { return false; }
00037
00038 private:
00039 void process_impact(ContactPtr c) const;
00040 unsigned _max_iterations;
00041 static const unsigned DEFAULT_MAX_ITERATIONS = 1;
00042 };
00043 }
00044
00045 #endif