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  *                      SimTK Core: SimTKcommon                               *
00006  * -------------------------------------------------------------------------- *
00007  * This is part of the SimTK Core biosimulation toolkit originating from      *
00008  * Simbios, the NIH National Center for Physics-Based Simulation of           *
00009  * Biological Structures at Stanford, funded under the NIH Roadmap for        *
00010  * Medical Research, grant U54 GM072970. See https://simtk.org.               *
00011  *                                                                            *
00012  * Portions copyright (c) 2005-7 Stanford University and the Authors.         *
00013  * Authors: Michael Sherman                                                   *
00014  * Contributors:                                                              *
00015  *                                                                            *
00016  * Permission is hereby granted, free of charge, to any person obtaining a    *
00017  * copy of this software and associated documentation files (the "Software"), *
00018  * to deal in the Software without restriction, including without limitation  *
00019  * the rights to use, copy, modify, merge, publish, distribute, sublicense,   *
00020  * and/or sell copies of the Software, and to permit persons to whom the      *
00021  * Software is furnished to do so, subject to the following conditions:       *
00022  *                                                                            *
00023  * The above copyright notice and this permission notice shall be included in *
00024  * all copies or substantial portions of the Software.                        *
00025  *                                                                            *
00026  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
00027  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   *
00028  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    *
00029  * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,    *
00030  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR      *
00031  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE  *
00032  * USE OR OTHER DEALINGS IN THE SOFTWARE.                                     *
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     // Internal use only
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 } // namespace SimTK
00178 
00179 #endif // SimTK_SimTKCOMMON_ANALYTIC_GEOMETRY_H_

Generated on Thu Feb 28 01:34:24 2008 for SimTKcommon by  doxygen 1.4.7