MBSim

Project Page
area.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 _AREA_H_
00021 #define _AREA_H_
00022 
00023 #include "mbsim/contours/plane.h"
00024 #include "fmatvec.h"
00025 #include "linear_algebra_double.h"
00026 #include "linear_algebra.h"
00027 
00028 namespace MBSim {
00029 
00035   class Area : public Plane {
00036     public:
00041       Area(const std::string &name);
00042 
00043       /* INHERITED INTERFACE OF ELEMENT */
00044       std::string getType() const {
00045         return "Area";
00046       }
00047       virtual void init(InitStage stage);
00048       /**********************************/
00049 
00050       /* GETTER / SETTER */
00051       void setLimitY(double l) {
00052         limy = l;
00053       }
00054       void setLimitZ(double l) {
00055         limz = l;
00056       }
00057 
00058       double getLimitY() const {
00059         return limy;
00060       }
00061       double getLimitZ() const {
00062         return limz;
00063       }
00064       //get vertex of the area, under reference frame of the area
00065       const fmatvec::Vec3 & getA() const {
00066         return RrA;
00067       }
00068       const fmatvec::Vec3 & getB() const {
00069         return RrB;
00070       }
00071       const fmatvec::Vec3 & getC() const {
00072         return RrC;
00073       }
00074       const fmatvec::Vec3 & getD() const {
00075         return RrD;
00076       }
00077 
00078       /***************************************************//*new added part by ting 05.10.2012*/
00085       bool PointInArea(const fmatvec::Vec3& Point); //need to be check again.......................................................
00086 
00094       bool PointInCircle(const fmatvec::Vec3& Point, const fmatvec::Vec3& CenCir, const double & radius);
00095 
00100       fmatvec::Vec3 Point_closest_toCircle_onLineseg(const fmatvec::Vec3& EndP1, const fmatvec::Vec3& EndP2, const fmatvec::Vec3& CenCir);
00101 
00110       bool Intersect_Circle(const double & radius, const fmatvec::Vec3& CenCir);
00111       /***************************************************/
00112 
00113 #ifdef HAVE_OPENMBVCPPINTERFACE
00114       virtual void enableOpenMBV(bool enable = true, int number = 10);
00115 #endif
00116 
00117     protected:
00118       double limy, limz;
00119       //vertices under reference frame
00123       fmatvec::Vec3 RrA;
00124 
00128       fmatvec::Vec3 RrB;
00129 
00133       fmatvec::Vec3 RrC;
00134 
00138       fmatvec::Vec3 RrD;
00139 
00140     private:
00144       void setVertices();
00145 
00146   };
00147 }
00148 
00149 #endif /* _AREA_H_ */