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 _GOCURVEBOUNDEDDOMAIN_H
00034 #define _GOCURVEBOUNDEDDOMAIN_H
00035
00036 #include "Domain.h"
00037 #include "RectDomain.h"
00038 #include "CurveLoop.h"
00039 #include "SplineSurface.h"
00040 #include "CurveOnSurface.h"
00041
00042 using std::vector;
00043 using std::pair;
00044 using boost::shared_ptr;
00045
00046 namespace Go
00047 {
00050
00051
00054 class CurveBoundedDomain : public Domain
00055 {
00056 public:
00058 CurveBoundedDomain()
00059 {}
00060
00064
00065
00072 CurveBoundedDomain(vector<shared_ptr<CurveLoop> > loops);
00073
00078 CurveBoundedDomain(shared_ptr<CurveLoop> ccw_loop);
00079
00081 virtual ~CurveBoundedDomain();
00082
00083
00084
00085
00094 virtual bool isInDomain(const Array<double, 2>& point,
00095 double tolerance) const;
00096
00104 virtual bool isOnBoundary(const Array<double, 2>& point,
00105 double tolerance) const;
00106
00115 virtual void closestInDomain(const Array<double, 2>& point,
00116 Array<double, 2>& clo_pt,
00117 double tolerance) const;
00118
00128 virtual void closestOnBoundary(const Array<double, 2>& point,
00129 Array<double, 2>& clo_bd_pt,
00130 double tolerance) const;
00131
00139 RectDomain containingDomain() const;
00140
00156 void clipWithDomain(int pardir, double parval,
00157 double tolerance, shared_ptr<SplineSurface> srf,
00158 vector<shared_ptr<CurveOnSurface> >& trim_pieces) const;
00159
00160
00161
00162
00163
00164
00165
00178 void findPcurveInsideSegments(const SplineCurve& curve,
00179 double tolerance,
00180 vector<double>& params_start_end_interval) const;
00181
00182 private:
00183 typedef struct intersection_point {
00184 double par1, par2;
00185 int pretop;
00186
00187 intersection_point(double p1, double p2, int top)
00188 { par1 = p1; par2 = p2; pretop = top;}
00189
00190 } intersection_point;
00191
00192
00193 static bool par1_compare(const intersection_point& el1,
00194 const intersection_point& el2)
00195 {
00196 if (el1.par1 < el2.par1)
00197 return true;
00198 else
00199 return false;
00200 }
00201
00202
00203
00204 vector<shared_ptr<CurveLoop> > loops_;
00205
00206
00207
00208
00209 void getInsideIntervals(int pardir, double parval, double tolerance,
00210 vector<pair<double, double> >& insideInts) const;
00211
00212
00213
00214
00215 shared_ptr<ParamCurve> getParameterCurve(int loop_nmb, int curve_nmb) const;
00216
00217
00218
00219
00220
00221
00222 void findPcurveInsideSegments(const SplineCurve& curve,
00223 double tolerance,
00224 vector<intersection_point>& intpt) const;
00225
00226 };
00227
00228
00230 }
00231
00232 #endif // _GOCURVEBOUNDEDDOMAIN_H
00233
00234