00001
00002
00003
00004
00005
00006
00007 #ifndef _LCP_RESTING_CONTACT_H
00008 #define _LCP_RESTING_CONTACT_H
00009
00010 #include <list>
00011 #include <boost/shared_ptr.hpp>
00012 #include <Physsim/Vector3.h>
00013 #include <Physsim/MatrixNN.h>
00014 #include <Physsim/PenaltyRestingContact.h>
00015 #include <Physsim/RestingContactMethod.h>
00016
00017 namespace Physsim {
00018
00019 class Contact;
00020
00022
00035 class LCPRestingContact : public RestingContactMethod
00036 {
00037 public:
00038 LCPRestingContact();
00039 virtual void clone(BasePtr& cloned, bimap<BasePtr, BasePtr>* obj_map = NULL) const;
00040 virtual bool is_struct_identical(BaseConstPtr object) const;
00041 virtual void load_state(BaseConstPtr object, bimap<BasePtr, BasePtr>* correspondence = NULL);
00042 virtual void save_state(BasePtr object, bimap<BasePtr, BasePtr>* correspondence = NULL) const;
00043 virtual void load_from_xml(XMLTreeConstPtr node, std::map<std::string, BasePtr>& id_map);
00044 virtual void save_to_xml(XMLTreePtr node, std::list<BaseConstPtr>& shared_objects) const;
00045 virtual void process_resting_contacts(const std::list<ContactPtr >& contacts);
00046
00048 virtual bool is_global_method() const { return true; }
00049
00050 private:
00051 static bool is_sticking_friction(const std::list<ContactPtr>& contacts);
00052 static VectorN solve_LCP_iterative(const MatrixNN& A, const VectorN& b, const VectorN& x, unsigned n_iter);
00053 static VectorN solve_LCP_iterative2(const MatrixNN& A, const VectorN& b, const VectorN& x, unsigned n_iter);
00054 void determine_contact_forces(const std::list<ContactPtr>& contacts) const;
00055 static void solve_LCP_iterative(const MatrixNN& A, const VectorN& b, VectorN& x, unsigned num_iter);
00056
00057 boost::shared_ptr<PenaltyRestingContact> _penalty_resting_contact;
00058 };
00059
00060 }
00061
00062 #endif
00063