AnalyticGeometry.h
Go to the documentation of this file.00001 #ifndef SimTK_SimTKCOMMON_ANALYTIC_GEOMETRY_H_
00002 #define SimTK_SimTKCOMMON_ANALYTIC_GEOMETRY_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00045 #include "SimTKcommon/Simmatrix.h"
00046
00047 #include <cassert>
00048
00049 namespace SimTK {
00050
00051 class DecorativeGeometry;
00052
00060 class SimTK_SimTKCOMMON_EXPORT AnalyticGeometry {
00061 public:
00062 AnalyticGeometry() : rep(0) { }
00063 ~AnalyticGeometry();
00064 AnalyticGeometry(const AnalyticGeometry&);
00065 AnalyticGeometry& operator=(const AnalyticGeometry&);
00066
00067 void setTransform(const Transform& X_BG);
00068 const Transform& getTransform() const;
00069
00070 DecorativeGeometry generateDecorativeGeometry() const;
00071
00074 bool isOwnerHandle() const;
00075 bool isEmptyHandle() const;
00076
00077
00078 explicit AnalyticGeometry(class AnalyticGeometryRep* r) : rep(r) { }
00079 bool hasRep() const {return rep!=0;}
00080 const AnalyticGeometryRep& getRep() const {assert(rep); return *rep;}
00081 AnalyticGeometryRep& updRep() {assert(rep); return *rep;}
00082 protected:
00083 class AnalyticGeometryRep* rep;
00084 };
00085
00086 class SimTK_SimTKCOMMON_EXPORT AnalyticCurve : public AnalyticGeometry {
00087 public:
00088 AnalyticCurve() { }
00089 Real calcArcLength() const;
00090 Vec3 calcPositionFromArcLengthParameter(const Real& s) const;
00091
00092 bool isClosed() const;
00093
00094 SimTK_PIMPL_DOWNCAST(AnalyticCurve, AnalyticGeometry);
00095 };
00096
00097 class SimTK_SimTKCOMMON_EXPORT AnalyticSurface : public AnalyticGeometry {
00098 public:
00099 AnalyticSurface() { }
00100
00101 Real calcArea() const;
00102 Vec3 calcPositionFromSurfaceParameters(const Vec2&) const;
00103 Vec3 calcNormalFromSurfaceParameters(const Vec2&) const;
00104
00105 SimTK_PIMPL_DOWNCAST(AnalyticSurface, AnalyticGeometry);
00106 };
00107
00108 class SimTK_SimTKCOMMON_EXPORT AnalyticVolume : public AnalyticGeometry {
00109 public:
00110 AnalyticVolume() { }
00111 Real calcVolume() const;
00112
00114 bool isPointInside(const Vec3&) const;
00115
00116 SimTK_PIMPL_DOWNCAST(AnalyticVolume, AnalyticGeometry);
00117 };
00118
00122 class SimTK_SimTKCOMMON_EXPORT AnalyticLine : public AnalyticCurve {
00123 public:
00124 AnalyticLine() { }
00125 AnalyticLine(const Vec3& p1, const Vec3& p2);
00126
00127 SimTK_PIMPL_DOWNCAST(AnalyticLine, AnalyticGeometry);
00128 };
00129
00137 class SimTK_SimTKCOMMON_EXPORT AnalyticCircle : public AnalyticCurve {
00138 public:
00139 AnalyticCircle() { }
00140 AnalyticCircle(Real radius);
00141
00142 SimTK_PIMPL_DOWNCAST(AnalyticCircle, AnalyticGeometry);
00143 };
00144
00145 class SimTK_SimTKCOMMON_EXPORT AnalyticSphere : public AnalyticVolume {
00146 public:
00147 AnalyticSphere() { }
00148 AnalyticSphere(Real radius);
00149
00150 SimTK_PIMPL_DOWNCAST(AnalyticSphere, AnalyticGeometry);
00151 };
00152
00157 class SimTK_SimTKCOMMON_EXPORT AnalyticCylinder : public AnalyticVolume {
00158 public:
00159 AnalyticCylinder() { }
00160 AnalyticCylinder(Real radius, Real halfLength);
00161
00162 SimTK_PIMPL_DOWNCAST(AnalyticCylinder, AnalyticGeometry);
00163 };
00164
00168 class SimTK_SimTKCOMMON_EXPORT AnalyticBrick : public AnalyticVolume {
00169 public:
00170 AnalyticBrick() { }
00171 AnalyticBrick(const Vec3& xyzHalfLengths);
00172
00173 SimTK_PIMPL_DOWNCAST(AnalyticBrick, AnalyticGeometry);
00174 };
00175
00176
00177 }
00178
00179 #endif // SimTK_SimTKCOMMON_ANALYTIC_GEOMETRY_H_