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 _PARAMCURVEINT_H
00034 #define _PARAMCURVEINT_H
00035
00036 #include "ParamGeomInt.h"
00037 #include "ParamCurve.h"
00038
00039
00040 namespace Go {
00043
00044
00045
00046 class RotatedBox;
00047
00048
00051
00052 class ParamCurveInt : public ParamGeomInt {
00053 public:
00059 explicit ParamCurveInt(boost::shared_ptr<ParamCurve> curve,
00060 ParamGeomInt* parent = 0);
00061
00063 virtual ~ParamCurveInt() {};
00064
00069 virtual void point(Point& res, const double *par) const
00070 { curve_->point(res, par[0]); }
00071
00083 virtual void point(std::vector<Point>& res,
00084 const double* par,
00085 int der,
00086 const bool* from_right = 0,
00087 double resolution = 1.0e-12) const
00088 {
00089 (from_right == 0)
00090 ? curve_->point(res, *par, der, true)
00091 : curve_->point(res, *par, der, from_right[0]);
00092 }
00093
00096 virtual ParamCurveInt* getParamCurveInt();
00097
00102 virtual ParamSurfaceInt* getParamSurfaceInt()
00103 { return NULL; }
00104
00107 boost::shared_ptr<ParamCurve> getParamCurve();
00108
00111 boost::shared_ptr<const ParamCurve> getParamCurve() const;
00112
00120 boost::shared_ptr<ParamCurve>
00121 getParentParamCurve(double& start, double& end);
00122
00127 boost::shared_ptr<ParamCurve> getParentParamCurve();
00128
00133 virtual boost::shared_ptr<ParamCurveInt>
00134 makeIntObject(boost::shared_ptr<ParamCurve> curve);
00135
00137 virtual int numParams() const;
00138
00146 virtual void getLengthAndWiggle(double *length, double *wiggle);
00147
00152 virtual bool hasInnerKnots(int pardir) const;
00153
00158 virtual bool hasCriticalVals(int pardir) const;
00159
00161 virtual void setCriticalVal(int pardir, double par);
00162
00167 virtual bool hasCriticalValsOrKnots(int pardir) const;
00168
00172 virtual bool canDivide(int pardir);
00173
00178 virtual std::vector<double> getCriticalVals(int pardir) const;
00179
00184 virtual std::vector<double> getInnerKnotVals(int pardir,
00185 bool sort = false) const;
00186
00191 virtual std::vector<double> getCriticalValsAndKnots(int pardir) const;
00192
00197 virtual int getMeshSize(int dir);
00198
00204 virtual double paramFromMesh(int dir, int idx);
00205
00207 virtual std::vector<double>::iterator getMesh();
00208
00212 virtual double startParam(int pardir) const
00213 { return curve_->startparam(); }
00214
00218 virtual double endParam(int pardir) const
00219 { return curve_->endparam(); }
00220
00226 virtual bool boundaryPoint(const double* par, double eps) const;
00227
00237 virtual void
00238 subdivide(int pardir, double par,
00239 std::vector<boost::shared_ptr<ParamGeomInt> >& subdiv_objs,
00240 std::vector<boost::shared_ptr<ParamGeomInt> >& bd_objs);
00241
00244 virtual CompositeBox compositeBox() const;
00245
00248 virtual DirectionCone directionCone() const;
00249
00252 virtual void
00253 getBoundaryObjects(std::vector<boost::
00254 shared_ptr<BoundaryGeomInt> >& bd_objs);
00255
00267 virtual int checkPeriodicity(int pardir = 0) const;
00268
00270 virtual int dimension() const
00271 { return dim_; }
00272
00275 double startparam() const
00276 { return curve_->startparam(); }
00277
00280 double endparam() const
00281 { return curve_->endparam(); }
00282
00283
00284
00289 void assureInRange(double& t);
00290
00296 virtual int knotIntervalFuzzy(double& t, double tol) const;
00297
00305 virtual double nextSegmentVal(double par,
00306 bool forward, double tol) const;
00307
00315 virtual bool isDegenerate(double epsge, int dir, double *par);
00316
00319 virtual bool isSpline();
00320
00321 virtual const SplineCurve* getSpline()
00322 { return 0; }
00323
00331 virtual double getOptimizedConeAngle(Point& axis1, Point& axis2);
00332
00339 virtual RotatedBox getRotatedBox(std::vector<Point>& axis) const;
00340
00343 void axisFromEndpts(Point& axis) const;
00344
00345 protected:
00346
00347 boost::shared_ptr<ParamCurve> curve_;
00348
00349 int dim_;
00350
00351 std::vector<std::pair<double, int> > segment_;
00352
00353
00354 mutable std::vector<double> mesh_;
00355
00356 mutable bool lw_set_;
00357 mutable double length_, wiggle_;
00358
00359 private:
00360
00361 void makeMesh(int size) const;
00362
00363 };
00364
00365
00367 }
00368
00369
00370 #endif // _PARAMCURVEINT_H
00371