//=========================================================================== // 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. //=========================================================================== 00017 #ifndef __DISC_H 00018 #define __DISC_H 00019 00020 00021 #include "GoTools/geometry/ElementarySurface.h" 00022 #include "GoTools/geometry/Circle.h" 00023 00024 00025 using boost::shared_ptr; 00026 00027 00028 namespace Go 00029 { 00030 00031 00032 class SplineSurface; 00033 00034 00055 00056 class Disc : public ElementarySurface 00057 { 00058 00059 public: 00060 00063 Disc() { } 00064 00070 Disc(Point centre, double radius, Point x_axis, Point normal); 00071 00073 virtual ~Disc() { } 00074 00075 00076 // Inherited from GeomObject 00079 virtual void read (std::istream& is); 00080 00081 // Inherited from GeomObject 00084 virtual void write (std::ostream& os) const; 00085 00086 // Inherited from GeomObject 00087 virtual int dimension() const; 00088 00089 // Inherited from GeomObject 00090 virtual ClassType instanceType() const; 00091 00092 // Inherited from GeomObject 00093 static ClassType classType() 00094 { return Class_Disc; } 00095 00096 // Inherited from GeomObject 00097 virtual BoundingBox boundingBox() const; 00098 00099 // Inherited from GeomObject 00100 virtual Disc* clone() const; 00101 00102 // --- Functions inherited from ParamSurface --- 00103 00104 const RectDomain& parameterDomain() const; 00105 00106 CurveLoop outerBoundaryLoop(double degenerate_epsilon 00107 = DEFAULT_SPACE_EPSILON) const; 00108 std::vector<CurveLoop> allBoundaryLoops(double degenerate_epsilon 00109 = DEFAULT_SPACE_EPSILON) const; 00110 00111 DirectionCone normalCone() const; 00112 DirectionCone tangentCone(bool pardir_is_u) const; 00113 00114 void point(Point& pt, double upar, double vpar) const; 00115 void point(std::vector<Point>& pts, 00116 double upar, double vpar, 00117 int derivs, 00118 bool u_from_right = true, 00119 bool v_from_right = true, 00120 double resolution = 1.0e-12) const; 00121 00122 void normal(Point& n, double upar, double vpar) const; 00123 00124 std::vector<boost::shared_ptr<ParamCurve> > 00125 constParamCurves(double parameter, bool pardir_is_u) const; 00126 00127 std::vector<boost::shared_ptr<ParamSurface> > 00128 subSurfaces(double from_upar, double from_vpar, 00129 double to_upar, double to_vpar, 00130 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00131 00132 double nextSegmentVal(int dir, double par, bool forward, double tol) const; 00133 00134 void closestPoint(const Point& pt, 00135 double& clo_u, 00136 double& clo_v, 00137 Point& clo_pt, 00138 double& clo_dist, 00139 double epsilon, 00140 const RectDomain* domain_of_interest = NULL, 00141 double *seed = 0) const; 00142 00143 void closestBoundaryPoint(const Point& pt, 00144 double& clo_u, 00145 double& clo_v, 00146 Point& clo_pt, 00147 double& clo_dist, 00148 double epsilon, 00149 const RectDomain* rd = NULL, 00150 double *seed = 0) const; 00151 00152 void getBoundaryInfo(Point& pt1, Point& pt2, 00153 double epsilon, SplineCurve*& cv, 00154 SplineCurve*& crosscv, double knot_tol = 1e-05) const; 00155 00156 void turnOrientation(); 00157 00158 void reverseParameterDirection(bool direction_is_u); 00159 00160 void swapParameterDirection(); 00161 00162 bool isDegenerate(bool& b, bool& r, 00163 bool& t, bool& l, double tolerance) const; 00164 00165 00167 virtual void getDegenerateCorners(std::vector<Point>& deg_corners, double tol) const; 00168 00169 Disc* subSurface(double from_upar, double from_vpar, 00170 double to_upar, double to_vpar, 00171 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00172 00173 virtual SplineSurface* geometrySurface() const; 00174 00175 00176 void useCentreDegen() 00177 { centre_degen_ = true; } 00178 00179 void useCornerDegen() 00180 { centre_degen_ = false; } 00181 00182 00183 private: 00184 00185 Point centre_; 00186 double radius_; 00187 Point 00188 x_axis_, 00189 y_axis_, 00190 z_axis_; 00191 bool centre_degen_; // If true, geometrySurface() gives a SplineSurface with 00192 // degenerecy in the centre 00193 // If false, let boundary curves of the SplineSurface 00194 // lie on the boundary 00195 double degen_angles_[4]; // The angle parameter value giving the four degeneracy 00196 // points on the boundary (only when center_degen = false) 00197 00198 RectDomain domain_; 00199 00200 void setCoordinateAxes(); 00201 void setParameterDomain(double from_upar, double from_vpar, 00202 double to_upar, double to_vpar); 00203 void setDefaultDomain(); 00204 Circle boundaryCircle() const; 00205 00206 }; // Class Disc 00207 00208 00209 } // namespace Go 00210 00211 00212 00213 #endif // #ifndef __DISC_H