PoissonRestitutionModel.h

00001 /****************************************************************************
00002  * Copyright 2007 Evan Drumwright
00003  * This library is distributed under the terms of the GNU General Public 
00004  * License (found in COPYING).
00005  ****************************************************************************/
00006 
00007 #ifndef _POISSON_RESTITUTION_MODEL_H
00008 #define _POISSON_RESTITUTION_MODEL_H
00009 
00010 #include <Physsim/CollisionMethod.h>
00011 
00012 namespace Physsim {
00013 
00015 class PoissonRestitutionModel : public CollisionMethod
00016 {
00017         public:
00018                 virtual void process_impacts(const std::list<ContactPtr >& contacts) const;
00019                 virtual void clone(BasePtr& cloned, bimap<BasePtr, BasePtr>* object_map = NULL) const;
00020                 virtual void load_from_xml(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00021                 virtual void save_to_xml(XMLTreePtr node, std::list<BaseConstPtr>& shared_objects) const;
00022                 virtual void load_state(BaseConstPtr object, bimap<BasePtr, BasePtr>* correspondence);
00023                 virtual void save_state(BasePtr object, bimap<BasePtr, BasePtr>* correspondence) const;
00024                 virtual bool is_global_method() const { return true; }
00025 
00026         private:
00027                 static VectorN do_compression_phase(const MatrixNN& A, const VectorN& b, const VectorN& mu);
00028                 static VectorN do_restitution_phase(const MatrixNN& A, const VectorN& b, const VectorN& mu, const VectorN& epsilon, const VectorN& x1_star);
00029                 bool is_struct_identical(BaseConstPtr object) const;
00030                 void apply_poisson_model(const std::list<ContactPtr>& contacts) const;
00031                 void determine_impulses(const std::list<ContactPtr>& contacts) const;
00032                 static Real det_alpha1_phase1(const MatrixN& rn, const VectorN& y, const VectorN& dy, const VectorN& xps, Real s1);
00033                 static Real det_alpha2_phase1(Real mu, Real xpi, const VectorN& y, const VectorN& dy, const VectorN& Ri, const VectorN& Rj, const VectorN& Rk, Real s2);
00034                 static Real det_alpha1_phase2(const MatrixNN& An, const VectorN& x1n_prime, const MatrixN& B, const VectorN& bn, const VectorN& y, const VectorN& dy, const VectorN& s1);
00035                 static Real det_alpha2_phase2(Real mu, Real x1n_primei, Real yj, Real yk, Real dyj, Real dyk, Real si);
00036                 static Real det_alpha3_phase2(Real x1t_prime_sq, const VectorN& y, const VectorN& dy, Real s3);
00037                 static Real display_ofn1(Real alpha, void* params);
00038                 static Real ofn1(Real alpha, void* params);
00039                 static Real ofn2(Real alpha, void* params);
00040                 static Real brent(Real x_upper, Real (*f)(Real, void*), void* params);
00041                 static Real square(Real x) { return x*x; }
00042                 static bool coulomb_constraints_sat(const VectorN& mu, const VectorN& x, const VectorN& s);
00043                 static bool coulomb_constraints_sat(const VectorN& mu, const VectorN& x1n_prime, const VectorN& y, const VectorN& s);
00044                 static bool np_constraints_sat(const VectorN& bias, const VectorN& y, const MatrixN& B, const VectorN& s);
00045 }; // end class
00046 } // end namespace
00047 
00048 #endif
00049 

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