//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00015 #ifndef _SURFACEOFREVOLUTION_H 00016 #define _SURFACEOFREVOLUTION_H 00017 00018 00019 #include "GoTools/geometry/ParamSurface.h" 00020 00021 00022 00023 namespace Go { 00024 00025 00026 class SplineCurve; 00027 class SplineSurface; 00028 00029 00050 00051 00052 class SurfaceOfRevolution : public ParamSurface 00053 { 00054 public: 00058 SurfaceOfRevolution() 00059 {}; 00060 00064 SurfaceOfRevolution(Point location, Point axis_dir, 00065 boost::shared_ptr<SplineCurve> curve); 00066 00068 virtual ~SurfaceOfRevolution(); 00069 00072 virtual void read (std::istream& is); 00075 virtual void write (std::ostream& os) const; 00076 00077 // Inherited from GeomObject 00078 virtual int dimension() const; 00079 00080 // Inherited from GeomObject 00081 virtual ClassType instanceType() const; 00082 00083 // Inherited from GeomObject 00084 static ClassType classType(); 00085 00086 // Inherited from GeomObject 00087 virtual BoundingBox boundingBox() const; 00088 00089 // Inherited from GeomObject 00090 virtual SurfaceOfRevolution* clone() const; 00091 00092 00093 // --- Functions inherited from ParamSurface --- 00094 00095 const RectDomain& parameterDomain() const; 00096 virtual RectDomain containingDomain() const; 00097 00098 virtual bool inDomain(double u, double v) const; 00099 00100 virtual Point closestInDomain(double u, double v) const; 00101 00102 CurveLoop outerBoundaryLoop(double degenerate_epsilon 00103 = DEFAULT_SPACE_EPSILON) const; 00104 std::vector<CurveLoop> allBoundaryLoops(double degenerate_epsilon 00105 = DEFAULT_SPACE_EPSILON) const; 00106 00107 DirectionCone normalCone() const; 00108 DirectionCone tangentCone(bool pardir_is_u) const; 00109 00110 void point(Point& pt, double upar, double vpar) const; 00111 void point(std::vector<Point>& pts, 00112 double upar, double vpar, 00113 int derivs, 00114 bool u_from_right = true, 00115 bool v_from_right = true, 00116 double resolution = 1.0e-12) const; 00117 00118 void normal(Point& n, double upar, double vpar) const; 00119 00120 std::vector<boost::shared_ptr<ParamCurve> > 00121 constParamCurves(double parameter, bool pardir_is_u) const; 00122 00123 std::vector<boost::shared_ptr<ParamSurface> > 00124 subSurfaces(double from_upar, double from_vpar, 00125 double to_upar, double to_vpar, 00126 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00127 00128 double nextSegmentVal(int dir, double par, bool forward, double tol) const; 00129 00130 void closestPoint(const Point& pt, 00131 double& clo_u, 00132 double& clo_v, 00133 Point& clo_pt, 00134 double& clo_dist, 00135 double epsilon, 00136 const RectDomain* domain_of_interest = NULL, 00137 double *seed = 0) const; 00138 00139 void closestBoundaryPoint(const Point& pt, 00140 double& clo_u, 00141 double& clo_v, 00142 Point& clo_pt, 00143 double& clo_dist, 00144 double epsilon, 00145 const RectDomain* rd = NULL, 00146 double *seed = 0) const; 00147 00148 void getBoundaryInfo(Point& pt1, Point& pt2, 00149 double epsilon, SplineCurve*& cv, 00150 SplineCurve*& crosscv, double knot_tol = 1e-05) const; 00151 00152 void turnOrientation(); 00153 00154 void reverseParameterDirection(bool direction_is_u); 00155 00156 void swapParameterDirection(); 00157 00158 virtual double area(double tol) const; 00159 00160 bool isDegenerate(bool& b, bool& r, 00161 bool& t, bool& l, double tolerance) const; 00162 00163 00166 virtual void getDegenerateCorners(std::vector<Point>& deg_corners, 00167 double tol) const; 00168 00169 00170 // --- Functions specific to SurfaceOfRevolution --- 00171 00172 Point getLocation() const 00173 { return location_; } 00174 00175 Point getAxisDir() const 00176 { return axis_dir_; } 00177 00178 boost::shared_ptr<SplineCurve> getCurve() const 00179 { return curve_; } 00180 00181 void setParameterBounds(double from_upar, double from_vpar, 00182 double to_upar, double to_vpar); 00183 00184 SurfaceOfRevolution* subSurface(double from_upar, double from_vpar, 00185 double to_upar, double to_vpar, 00186 double fuzzy 00187 = DEFAULT_PARAMETER_EPSILON) const; 00188 00189 // Is "geometrySurface()" a good name for this function? @jbt 00190 virtual SplineSurface* geometrySurface() const; 00191 00192 private: 00193 Point location_; 00194 Point axis_dir_; 00195 boost::shared_ptr<SplineCurve> curve_; 00196 00197 RectDomain domain_; 00198 void setDefaultDomain(); 00199 00200 }; 00201 00202 00203 } // namespace Go 00204 00205 00206 #endif // _SURFACEOFREVOLUTION_H 00207
Generated on Tue Sep 21 15:44:17 2010 for GoTools Core by  doxygen 1.6.3