MBSim |
Project Page |
00001 /* Copyright (C) 2004-2009 MBSim Development Team 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 * Contact: martin.o.foerg@googlemail.com 00018 */ 00019 00020 #ifndef _CONTACT_KINEMATICS_H_ 00021 #define _CONTACT_KINEMATICS_H_ 00022 00023 #include "fmatvec/fmatvec.h" 00024 #include "fmatvec/atom.h" 00025 #include "mbsim/mbsim_event.h" 00026 #include <mbsim/single_contact.h> 00027 #include <vector> 00028 00029 namespace MBSim { 00030 00031 class Contour; 00032 class ContourPointData; 00033 00038 fmatvec::Vec3 computeTangential(const fmatvec::Vec3 &n); 00039 00047 class ContactKinematics : virtual public fmatvec::Atom { 00048 public: 00052 ContactKinematics() : numberOfPotentialContactPoints(1) {} 00053 00057 virtual ~ContactKinematics() {} 00058 00059 /* INTERFACE FOR DERIVED CLASSES */ 00064 virtual void assignContours(const std::vector<Contour*> &contour) = 0; 00065 00072 virtual void updateg(fmatvec::Vec &g, ContourPointData *cpData, int index = 0) = 0; 00073 00080 virtual void updatewb(fmatvec::Vec &wb, const fmatvec::Vec &g, ContourPointData* cpData) = 0; 00081 00088 virtual void updateg(std::vector<SingleContact> & contact) {if(contact[0].getg().size()) updateg(contact[0].getg(), contact[0].getcpData());} 00089 00090 virtual void updatewb(std::vector<SingleContact> & contact) {if(contact[0].getwb().size()) updatewb(contact[0].getwb(), contact[0].getg(), contact[0].getcpData());} 00091 00097 void assignContours(Contour *contour1, Contour *contour2) { std::vector<Contour*> c; c.push_back(contour1);c.push_back(contour2); assignContours(c); } 00098 00102 int getNumberOfPotentialContactPoints() const { return numberOfPotentialContactPoints; } 00103 00104 virtual ContactKinematics* getContactKinematics(int i=0) const { return 0; } 00105 00109 // virtual void computeCurvatures(std::vector<fmatvec::Vec>::iterator ir, std::vector<ContourPointData*>::iterator icpData) { if((*ir).size()) computeRadii(*ir, *icpData); } 00110 virtual void computeCurvatures(fmatvec::Vec &r, ContourPointData *cpData) {throw MBSimError("(ContactKinematics::computeCurvatures): Not implemented.");} 00111 00112 protected: 00116 int numberOfPotentialContactPoints; 00117 }; 00118 00119 } 00120 00121 #endif /* _CONTACT_KINEMATICS_H_ */ 00122
1.8.0