00001
00002
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 #ifndef _GOBOUNDEDSURFACE_H
00034 #define _GOBOUNDEDSURFACE_H
00035
00036 #include "ParamSurface.h"
00037 #include "CurveOnSurface.h"
00038 #include "CurveBoundedDomain.h"
00039
00040 using boost::shared_ptr;
00041 using std::vector;
00042
00043 namespace Go
00044 {
00047
00048
00050 class BoundedSurface : public ParamSurface
00051 {
00052 public:
00053
00055 BoundedSurface();
00056
00067 BoundedSurface(shared_ptr<ParamSurface> surf,
00068 vector<shared_ptr<CurveOnSurface> > loop,
00069 double space_epsilon);
00070
00071
00085 BoundedSurface(shared_ptr<ParamSurface> surf,
00086 vector<vector<shared_ptr<CurveOnSurface> > > loops,
00087 double space_epsilon);
00088
00090 virtual ~BoundedSurface();
00091
00092
00093
00094
00095
00097 virtual void read (std::istream& is);
00099 virtual void write (std::ostream& os) const;
00100
00101
00102
00104 virtual BoundingBox boundingBox() const;
00105
00107 virtual int dimension() const;
00108
00110 virtual ClassType instanceType() const;
00111
00113 static ClassType classType()
00114 { return Class_BoundedSurface; }
00115
00117 virtual BoundedSurface* clone() const
00118 { return new BoundedSurface(*this); }
00119
00120
00121
00125 virtual DirectionCone normalCone() const;
00126
00134 virtual DirectionCone tangentCone(bool pardir_is_u) const;
00135
00141 virtual const CurveBoundedDomain& parameterDomain() const;
00142
00148 virtual RectDomain containingDomain() const;
00149
00150
00156 virtual CurveLoop outerBoundaryLoop(double degenerate_epsilon
00157 = DEFAULT_SPACE_EPSILON) const;
00158
00167 virtual std::vector<CurveLoop> allBoundaryLoops(double degenerate_epsilon
00168 = DEFAULT_SPACE_EPSILON) const;
00169
00177 std::vector<CurveLoop> absolutelyAllBoundaryLoops() const;
00178
00179
00184 virtual void point(Point& pt, double upar, double vpar) const;
00185
00186
00210 virtual void point(std::vector<Point>& pts,
00211 double upar, double vpar,
00212 int derivs,
00213 bool u_from_right = true,
00214 bool v_from_right = true,
00215 double resolution = 1.0e-12) const;
00216
00231 virtual void point(std::vector<Point>& pts,
00232 double upar, double vpar,
00233 int derivs) const;
00234
00235
00240 virtual void normal(Point& n, double upar, double vpar) const;
00241
00252 virtual std::vector<boost::shared_ptr<ParamCurve> >
00253 constParamCurves(double parameter, bool pardir_is_u) const;
00254
00268 virtual std::vector<boost::shared_ptr<ParamSurface> >
00269 subSurfaces(double from_upar, double from_vpar,
00270 double to_upar, double to_vpar,
00271 double fuzzy = DEFAULT_PARAMETER_EPSILON) const;
00272
00291 virtual double nextSegmentVal(int dir, double par, bool forward, double tol) const;
00292
00305 virtual void closestPoint(const Point& pt,
00306 double& clo_u,
00307 double& clo_v,
00308 Point& clo_pt,
00309 double& clo_dist,
00310 double epsilon,
00311 const RectDomain* domain_of_interest = NULL,
00312 double *seed = 0) const;
00313
00314
00317 virtual void closestBoundaryPoint(const Point& pt,
00318 double& clo_u,
00319 double& clo_v,
00320 Point& clo_pt,
00321 double& clo_dist,
00322 double epsilon,
00323 const RectDomain* domain_of_interest = NULL,
00324 double *seed = 0) const;
00325
00348 virtual void getBoundaryInfo(Point& pt1, Point& pt2,
00349 double epsilon, SplineCurve*& cv,
00350 SplineCurve*& crosscv, double knot_tol = 1e-05) const;
00351
00352
00361 void getBoundaryInfo(Point& pt1, Point& pt2,
00362 vector<shared_ptr<CurveOnSurface> >& bd_cvs) const;
00363
00365 virtual void turnOrientation();
00366
00371 virtual void reverseParameterDirection(bool direction_is_u);
00372
00373
00374
00375
00381 void makeBoundaryCurvesG1(double kink);
00382
00384 virtual void swapParameterDirection();
00385
00392 void setParameterDomain(double u1, double u2, double v1, double v2);
00393
00394
00395
00396
00400 void splitSingleLoops();
00401
00402
00403
00406 shared_ptr<ParamSurface> underlyingSurface()
00407 { return surface_; }
00408
00411 shared_ptr<const ParamSurface> underlyingSurface() const
00412 { return surface_; }
00413
00415 int numberOfLoops()
00416 { return boundary_loops_.size(); }
00417
00419 shared_ptr<CurveLoop> loop(int idx)
00420 { return boundary_loops_[idx]; }
00421
00431 SplineCurve* constParamCurve(double parameter, bool direction_is_u) const;
00432
00444 virtual bool isDegenerate(bool& b, bool& r,
00445 bool& t, bool& l, double tolerance) const;
00446
00447
00448 private:
00450 shared_ptr<ParamSurface> surface_;
00451
00454 vector<shared_ptr<CurveLoop> > boundary_loops_;
00455
00456 mutable CurveBoundedDomain domain_;
00457
00460 void orderBoundaryLoops(double degenerate_epsilon = DEFAULT_SPACE_EPSILON);
00461
00462
00463 vector<shared_ptr<CurveOnSurface> >
00464 splitIntoC1Curves(shared_ptr<CurveOnSurface>& curve, double space_epsilon, double kink);
00465
00466
00467 double getEpsGeo() const;
00468
00469 };
00470
00471
00473 }
00474
00475
00476 #endif // _GOBOUNDEDSURFACE_H
00477
00478