MBSim

Project Page
edge.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: martin.o.foerg@googlemail.com
00018  */
00019 
00020 #ifndef _EDGE_H_
00021 #define _EDGE_H_
00022 
00023 #include "mbsim/contour.h"
00024 
00025 #ifdef HAVE_OPENMBVCPPINTERFACE
00026 #include <mbsim/utils/openmbv_utils.h>
00027 #endif
00028 
00029 namespace MBSim {
00030 
00037   class Edge : public MBSim::RigidContour {
00038     public:
00043       Edge(const std::string &name="", Frame *R=0) : RigidContour(name,R), length(1), thickness(0.01) {};
00044 
00045       std::string getType() const {return "Edge";}
00046       virtual void init(InitStage stage);
00047 
00048       virtual void updateKinematicsForFrame(ContourPointData &cp, Frame::Feature ff);
00049 
00050       /* GETTER / SETTER */
00051       void setLength(double length_) {length = length_;}
00052       double getLength() const { return length; }
00053       double getThickness() const {return thickness;}
00054       /***************************************************/
00055 
00056 #ifdef HAVE_OPENMBVCPPINTERFACE
00057       BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, tag, (optional (diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) { 
00058         OpenMBVLine ombv(1,diffuseColor,transparency);
00059         openMBVRigidBody=ombv.createOpenMBV(); 
00060       }
00061 #endif
00062 
00063     private:
00064       double length, thickness;
00065   };
00066 }
00067 
00068 #endif /* _EDGE_H_ */