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 #ifdef HAVE_OPENMBVCPPINTERFACE
00026 #include <mbsim/utils/openmbv_utils.h>
00027 #endif
00028 
00029 namespace MBSim {
00030 
00031   class ContourFunction1s;
00032   class ContactKinematics;
00033 
00040   class Contour1sAnalytical : public Contour1s {
00041     public:
00046       Contour1sAnalytical(const std::string &name="") : Contour1s(name)
00047                                                      {}
00048 
00052       virtual ~Contour1sAnalytical();
00053 
00054       /* INHERITED INTERFACE OF ELEMENT */
00055       std::string getType() const { return "Contour1sAnalytical"; }
00056       virtual void plot(double t, double dt = 1);
00057       /***************************************************/
00058 
00059       /* INHERITED INTERFACE OF CONTOUR */
00060       virtual void updateKinematicsForFrame(ContourPointData &cp, Frame::Feature ff);
00061       virtual void updateJacobiansForFrame(ContourPointData &cp, int j=0);
00062       virtual void init(InitStage stage);
00063       virtual double computeCurvature(ContourPointData &cp);
00064       virtual double computeDistance(const double s, const int order=0);
00065       /***************************************************/
00066 
00067       /* INHERITED INTERFACE OF CONTOURCONTINUUM */
00068       virtual void computeRootFunctionPosition(ContourPointData &cp) { updateKinematicsForFrame(cp,Frame::position); }
00069       virtual void computeRootFunctionFirstTangent(ContourPointData &cp) { updateKinematicsForFrame(cp,Frame::firstTangent); }
00070       virtual void computeRootFunctionNormal(ContourPointData &cp) { updateKinematicsForFrame(cp,Frame::normal); }
00071       virtual void computeRootFunctionSecondTangent(ContourPointData &cp) { updateKinematicsForFrame(cp,Frame::secondTangent); }
00072       /***************************************************/
00073 
00074       /* GETTER / SETTER */
00075       void setContourFunction1s(ContourFunction1s* f) { funcCrPC = f; }
00076       ContourFunction1s* getContourFunction1s() { return funcCrPC; }
00077       /***************************************************/
00078 
00079 #ifdef HAVE_OPENMBVCPPINTERFACE
00080       BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, tag, (optional (diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) { 
00081         OpenMBVExtrusion ombv(1,diffuseColor,transparency);
00082         openMBVRigidBody=ombv.createOpenMBV(); 
00083       }
00084 #endif
00085       
00086       virtual void initializeUsingXML(xercesc::DOMElement *element);
00087       virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *element);
00088 
00094       ContactKinematics * findContactPairingWith(std::string type0, std::string type1);
00095 
00096     protected:
00097       ContourFunction1s * funcCrPC;
00098 #ifdef HAVE_OPENMBVCPPINTERFACE
00099       boost::shared_ptr<OpenMBV::RigidBody> openMBVRigidBody;
00100 #endif
00101   };
00102 
00103 }
00104 
00105 #endif /* _CONTOUR1S_ANALYTICAL_H_ */
00106