MBSim

Project Page
frustum2d.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: mfeorg@users.berlios.de
00018  */
00019 
00020 #ifndef _FRUSTUM2D_H_
00021 #define _FRUSTUM2D_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 Frustum2D : public RigidContour {
00038     public:
00043       Frustum2D(const std::string &name) : RigidContour(name), h(0) {}
00044 
00045       /* INHERITED INTERFACE OF ELEMENT */
00046       std::string getType() const { return "Frustum2D"; }
00047       virtual void init(InitStage stage);
00048       /***************************************************/
00049 
00050       /* GETTER / SETTER */
00051       void setRadii(const fmatvec::Vec2 &r_) { r = r_; }
00052       const fmatvec::Vec2& getRadii() const { return r; } 
00053       void setHeight(double h_) { h = h_; }
00054       double getHeight() const { return h; } 
00055       /***************************************************/
00056 
00057 #ifdef HAVE_OPENMBVCPPINTERFACE
00058       BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, tag, (optional (diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0))) { 
00059         OpenMBVFrustum ombv(1,1,1,diffuseColor,transparency);
00060         openMBVRigidBody=ombv.createOpenMBV(); 
00061       }
00062 #endif
00063 
00064     private:
00068       fmatvec::Vec2 r;
00069 
00073       double h;
00074 
00075   };
00076   
00077 }
00078 
00079 #endif /* _FRUSTUM2D_H_ */