MBSim

Project Page
contour1s_analytical.h
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: thschindler@users.berlios.de
00018  */
00019 
00020 #ifndef _CONTOUR1S_ANALYTICAL_H_
00021 #define _CONTOUR1S_ANALYTICAL_H_
00022 
00023 #include "mbsim/contours/contour1s.h"
00024 
00025 namespace MBSim {
00026 
00027   class ContourFunction1s;
00028   class ContactKinematics;
00029 
00036   class Contour1sAnalytical : public Contour1s {
00037     public:
00042       Contour1sAnalytical(const std::string &name="") : Contour1s(name)
00043 # ifdef HAVE_OPENMBVCPPINTERFACE
00044                                                      , openMBVRigidBody(0)
00045 # endif
00046                                                      {}
00047 
00051       virtual ~Contour1sAnalytical();
00052 
00053       /* INHERITED INTERFACE OF ELEMENT */
00054       std::string getType() const { return "Contour1sAnalytical"; }
00055       virtual void plot(double t, double dt = 1);
00056       /***************************************************/
00057 
00058       /* INHERITED INTERFACE OF CONTOUR */
00059       virtual void updateKinematicsForFrame(ContourPointData &cp, FrameFeature ff);
00060       virtual void updateJacobiansForFrame(ContourPointData &cp, int j=0);
00061       virtual void init(InitStage stage);
00062       virtual double computeCurvature(ContourPointData &cp);
00063       virtual double computeDistance(const double s, const int order=0);
00064       /***************************************************/
00065 
00066       /* INHERITED INTERFACE OF CONTOURCONTINUUM */
00067       virtual void computeRootFunctionPosition(ContourPointData &cp) { updateKinematicsForFrame(cp,position); }
00068       virtual void computeRootFunctionFirstTangent(ContourPointData &cp) { updateKinematicsForFrame(cp,firstTangent); }
00069       virtual void computeRootFunctionNormal(ContourPointData &cp) { updateKinematicsForFrame(cp,normal); }
00070       virtual void computeRootFunctionSecondTangent(ContourPointData &cp) { updateKinematicsForFrame(cp,secondTangent); }
00071       /***************************************************/
00072 
00073       /* GETTER / SETTER */
00074       void setContourFunction1s(ContourFunction1s* f) { funcCrPC = f; }
00075       ContourFunction1s* getContourFunction1s() { return funcCrPC; }
00076       /***************************************************/
00077 
00078 #ifdef HAVE_OPENMBVCPPINTERFACE
00079       void enableOpenMBV(bool enable=true);
00080 #endif
00081       
00082       virtual void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00083       virtual MBXMLUtils::TiXmlElement* writeXMLFile(MBXMLUtils::TiXmlNode *element);
00084 
00090       ContactKinematics * findContactPairingWith(std::string type0, std::string type1);
00091 
00092     protected:
00093       ContourFunction1s * funcCrPC;
00094 #ifdef HAVE_OPENMBVCPPINTERFACE
00095       OpenMBV::RigidBody *openMBVRigidBody;
00096 #endif
00097   };
00098 
00099 }
00100 
00101 #endif /* _CONTOUR1S_ANALYTICAL_H_ */
00102