00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _RECTANGLE_H_
00021 #define _RECTANGLE_H_
00022
00023 #include "mbsim/contours/plane.h"
00024 #include "fmatvec/fmatvec.h"
00025 #include "fmatvec/linear_algebra_double.h"
00026 #include "fmatvec/linear_algebra.h"
00027
00028 namespace MBSim {
00029
00035 class Rectangle : public Plane {
00036 public:
00041 Rectangle(const std::string &name);
00042
00043
00044 std::string getType() const {
00045 return "Rectangle";
00046 }
00047 virtual void init(InitStage stage);
00048
00049
00050
00051 void setYLength(double l) {
00052 yLength = l;
00053 }
00054 void setZLength(double l) {
00055 zLength = l;
00056 }
00057 void setThickness(double thickness_) {thickness = thickness_;}
00058
00059 double getYLength() const {
00060 return yLength;
00061 }
00062 double getZLength() const {
00063 return zLength;
00064 }
00065
00066 const fmatvec::Vec3 & getA() const {
00067 return RrA;
00068 }
00069 const fmatvec::Vec3 & getB() const {
00070 return RrB;
00071 }
00072 const fmatvec::Vec3 & getC() const {
00073 return RrC;
00074 }
00075 const fmatvec::Vec3 & getD() const {
00076 return RrD;
00077 }
00078 double getThickness() const {return thickness;}
00079
00080
00087 bool PointInRectangle(const fmatvec::Vec3& Point);
00088
00096 bool PointInCircle(const fmatvec::Vec3& Point, const fmatvec::Vec3& CenCir, const double & radius);
00097
00102 fmatvec::Vec3 Point_closest_toCircle_onLineseg(const fmatvec::Vec3& EndP1, const fmatvec::Vec3& EndP2, const fmatvec::Vec3& CenCir);
00103
00112 bool Intersect_Circle(const double & radius, const fmatvec::Vec3& CenCir);
00113
00114
00115 #ifdef HAVE_OPENMBVCPPINTERFACE
00116 virtual void enableOpenMBV(bool enable = true, int number = 10);
00117 #endif
00118
00119 protected:
00120 double yLength, zLength, thickness;
00121
00125 fmatvec::Vec3 RrA;
00126
00130 fmatvec::Vec3 RrB;
00131
00135 fmatvec::Vec3 RrC;
00136
00140 fmatvec::Vec3 RrD;
00141
00142 private:
00146 void setVertices();
00147
00148 };
00149 }
00150
00151 #endif