MBSim

Project Page
contour1s.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_H_
00021 #define _CONTOUR1S_H_
00022 
00023 #include "mbsim/contours/contour_continuum.h"
00024 
00025 #ifdef HAVE_OPENMBVCPPINTERFACE
00026 #include <openmbvcppinterface/spineextrusion.h>
00027 #endif
00028 
00029 namespace MBSim {
00030 
00037   class Contour1s : public ContourContinuum<double> {
00038     public:
00043       Contour1s(const std::string &name);
00044 
00045       /* INHERITED INTERFACE OF ELEMENT */
00046       std::string getType() const {
00047         return "Contour1s";
00048       }
00049       void init(InitStage stage_);
00050       void plot(double t, double dt);
00051       /***************************************************/
00052 
00053       /* INTERFACE FOR DERIVED CLASSES */
00058       virtual fmatvec::Vec3 computeTangent(ContourPointData &cp) {
00059         updateKinematicsForFrame(cp, Frame::firstTangent);
00060         return cp.getFrameOfReference().getOrientation().col(1);
00061       }
00062 
00067       virtual fmatvec::Vec3 computeBinormal(ContourPointData &cp) {
00068         updateKinematicsForFrame(cp, Frame::secondTangent);
00069         return cp.getFrameOfReference().getOrientation().col(2);
00070       }
00071       /***************************************************/
00072 
00077       virtual double computeCurvature(ContourPointData &cp) {
00078         THROW_MBSIMERROR("(Contour::computeCurvature): Not implemented.");
00079         return 0;
00080       }
00081 
00087       virtual double computeDistance(const double s, const int order = 0) {
00088         THROW_MBSIMERROR("(Contour::computeDistance): Not implemented.");
00089         return 0;
00090       }
00091 
00092       /* GETTER / SETTER */
00093       void setDiameter(double diameter_) {
00094         diameter = diameter_;
00095       }
00096       double getDiameter() {
00097         return diameter;
00098       }
00099       /***************************************************/
00100 
00101 
00102 #ifdef HAVE_OPENMBVCPPINTERFACE
00103       void setOpenMBVSpineExtrusion(OpenMBV::SpineExtrusion* spineExtrusion) {
00104         openMBVSpineExtrusion = spineExtrusion;
00105       }
00106       OpenMBV::Body* getOpenMBVSpineExtrusion() {
00107         return openMBVSpineExtrusion;
00108       }
00109 #endif
00110 
00111     protected:
00117       double diameter;
00118 
00119 #ifdef HAVE_OPENMBVCPPINTERFACE
00120 
00123       OpenMBV::SpineExtrusion* openMBVSpineExtrusion;
00124 
00125 #endif
00126 
00127   };
00128 
00129 }
00130 
00131 #endif /* _CONTOUR1S_H_ */
00132