//=========================================================================== // 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 _PARAMSURFACE_H 00016 #define _PARAMSURFACE_H 00017 00018 #include "GoTools/geometry/Domain.h" 00019 #include "GoTools/geometry/GeomObject.h" 00020 #include "GoTools/geometry/RectDomain.h" 00021 #include "GoTools/geometry/CurveLoop.h" 00022 #include <vector> 00023 #include "GoTools/utils/config.h" 00024 00025 00026 namespace Go 00027 { 00028 00029 enum IteratorType 00030 { 00031 Iterator_parametric = 0, 00032 Iterator_geometric = 1 00033 }; 00034 00035 class CurveLoop; // forward declaration 00036 class SplineSurface; 00037 00041 class GO_API ParamSurface : public GeomObject 00042 { 00043 public: 00045 virtual ~ParamSurface(); 00046 00050 virtual ParamSurface* clone() const = 0; 00051 00053 virtual SplineSurface* asSplineSurface() 00054 { 00055 return 0; // Default behaviour 00056 } 00057 00063 virtual const Domain& parameterDomain() const = 0; 00064 00070 virtual RectDomain containingDomain() const = 0; 00071 00073 virtual bool inDomain(double u, double v) const = 0; 00074 00075 virtual Point closestInDomain(double u, double v) const = 0; 00076 00082 virtual CurveLoop outerBoundaryLoop(double degenerate_epsilon 00083 = DEFAULT_SPACE_EPSILON) const = 0; 00084 00093 virtual std::vector<CurveLoop> allBoundaryLoops(double degenerate_epsilon 00094 = DEFAULT_SPACE_EPSILON) const = 0; 00095 00097 virtual ParamSurface* mirrorSurface(const Point& pos, 00098 const Point& norm) const 00099 { 00100 return 0; // For the time being 00101 } 00102 00106 virtual DirectionCone normalCone() const = 0; 00107 00115 virtual DirectionCone tangentCone(bool pardir_is_u) const = 0; 00116 00124 virtual CompositeBox compositeBox() const; 00125 00130 virtual void point(Point& pt, double upar, double vpar) const = 0; 00131 00155 virtual void point(std::vector<Point>& pts, 00156 double upar, double vpar, 00157 int derivs, 00158 bool u_from_right = true, 00159 bool v_from_right = true, 00160 double resolution = 1.0e-12) const = 0; 00161 00170 Point point(double upar, double vpar) const; 00171 00187 std::vector<Point> point(double upar, double vpar, 00188 int derivs) const; 00189 00194 virtual void normal(Point& n, double upar, double vpar) const = 0; 00195 00198 virtual Point getInternalPoint(double& u, double& v) const; 00199 00210 virtual std::vector<boost::shared_ptr<ParamCurve> > 00211 constParamCurves(double parameter, bool pardir_is_u) const = 0; 00212 00226 virtual std::vector<boost::shared_ptr<ParamSurface> > 00227 subSurfaces(double from_upar, double from_vpar, 00228 double to_upar, double to_vpar, 00229 double fuzzy = DEFAULT_PARAMETER_EPSILON) const = 0; 00230 00249 virtual double nextSegmentVal(int dir, double par, bool forward, double tol) const = 0; 00250 00263 virtual void closestPoint(const Point& pt, 00264 double& clo_u, 00265 double& clo_v, 00266 Point& clo_pt, 00267 double& clo_dist, 00268 double epsilon, 00269 const RectDomain* domain_of_interest = NULL, 00270 double *seed = 0) const = 0; 00271 00272 void singularity(double& sing_u, 00273 double& sing_v, 00274 Point& sing_pt, 00275 double& sing_dist, 00276 double epsilon, 00277 const RectDomain* rd = NULL, 00278 double *seed = 0) const; 00279 00282 virtual void closestBoundaryPoint(const Point& pt, 00283 double& clo_u, 00284 double& clo_v, 00285 Point& clo_pt, 00286 double& clo_dist, 00287 double epsilon, 00288 const RectDomain* rd = NULL, 00289 double *seed = 0) const = 0; 00290 00312 virtual void getBoundaryInfo(Point& pt1, Point& pt2, 00313 double epsilon, SplineCurve*& cv, 00314 SplineCurve*& crosscv, double knot_tol = 1e-05) const = 0; 00315 00317 virtual void turnOrientation() = 0; 00318 00322 virtual void reverseParameterDirection(bool direction_is_u) = 0; 00323 00325 virtual void swapParameterDirection() = 0; 00326 00332 virtual double area(double tol) const = 0; 00333 00336 00348 virtual bool isDegenerate(bool& b, bool& r, 00349 bool& t, bool& l, double tolerance) const = 0; 00350 00352 virtual void getDegenerateCorners(std::vector<Point>& deg_corners, double tol) const = 0; 00353 00354 virtual void setIterator(IteratorType type) 00355 { 00356 iterator_ = type; 00357 } 00358 00360 virtual bool isIsoTrimmed(double tol) const 00361 { 00362 return true; // Default answer 00363 } 00364 00366 virtual bool isSpline() const 00367 { 00368 return false; // Default behaviour, overridden in the spline case 00369 } 00370 00371 protected: 00372 IteratorType iterator_; 00373 00374 ParamSurface() 00375 : iterator_(Iterator_parametric) 00376 { 00377 } 00378 00379 00380 }; 00381 00382 00383 } // namespace Go 00384 00385 00386 #endif // _PARAMSURFACE_H 00387