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 _PAR1FUNCINT_H
00034 #define _PAR1FUNCINT_H
00035
00036
00037 #include "ParamFunctionInt.h"
00038 #include "ParamCurve.h"
00039
00040
00041 namespace Go {
00044
00045
00046
00049
00050 class Param1FunctionInt : public ParamFunctionInt {
00051 public:
00055 explicit Param1FunctionInt(boost::shared_ptr<ParamCurve> curve);
00056
00062 explicit Param1FunctionInt(boost::shared_ptr<ParamCurve> curve,
00063 ParamFunctionInt *parent);
00064
00066 virtual ~Param1FunctionInt();
00067
00072 virtual void point(Point& res, const double *par) const
00073 { curve_->point(res, par[0]); }
00074
00081 virtual void point(std::vector<Point>& res, double par, int der)
00082 { curve_->point(res, par, der); }
00083
00095 virtual void point(std::vector<Point>& pt,
00096 const double* tpar,
00097 int derivs,
00098 const bool* from_right = 0,
00099 double resolution = 1.0e-12) const
00100 {
00101 bool fr = (from_right != 0) ? from_right[0] : true;
00102 pt = curve_->point(*tpar, derivs, fr);
00103 }
00104
00106 virtual Param1FunctionInt* getParam1FunctionInt();
00107
00109 boost::shared_ptr<ParamCurve> getParamCurve();
00111 boost::shared_ptr<const ParamCurve> getParamCurve() const;
00112
00117 boost::shared_ptr<ParamCurve> getParentParamCurve(double& start,
00118 double& end);
00123 boost::shared_ptr<ParamCurve> getParentParamCurve();
00124
00129 virtual boost::shared_ptr<Param1FunctionInt>
00130 makeIntFunction(boost::shared_ptr<ParamCurve> curve);
00131
00133 virtual int numParams() const;
00134
00142 virtual void getLengthAndWiggle(double *length, double *wiggle);
00143
00148 virtual bool hasInnerKnots(int pardir) const;
00149
00154 virtual bool hasCriticalVals(int pardir) const;
00155
00160 virtual bool hasCriticalValsOrKnots(int pardir) const;
00161
00165 virtual bool canDivide(int pardir);
00166
00171 virtual std::vector<double> getCriticalVals(int pardir) const;
00172
00177 virtual std::vector<double> getInnerKnotVals(int pardir,
00178 bool sort = false) const;
00179
00184 virtual std::vector<double> getCriticalValsAndKnots(int pardir) const;
00185
00190 virtual int getMeshSize(int dir);
00191
00197 virtual double paramFromMesh(int dir, int idx);
00198
00200 virtual std::vector<double>::iterator getMesh();
00201
00205 virtual double startParam(int pardir) const
00206 { return curve_->startparam(); }
00207
00211 virtual double endParam(int pardir) const
00212 { return curve_->endparam(); }
00213
00219 virtual bool boundaryPoint(const double* par, double eps) const;
00220
00230 virtual void subdivide(int pardir, double par,
00231 std::vector<boost::
00232 shared_ptr<ParamFunctionInt> >& subdiv_objs,
00233 std::vector<boost::
00234 shared_ptr<ParamFunctionInt> >& bd_objs);
00235
00236
00237
00243 virtual bool monotone(Point& dir, double tol=1.0e-15) const;
00244
00246 virtual CompositeBox compositeBox() const;
00247
00250 virtual void
00251 getBoundaryObjects(std::vector<boost::
00252 shared_ptr<BoundaryFunctionInt> >& bd_objs);
00253
00255 int dimension()
00256 { return dim_; }
00257
00259 double startparam() const
00260 { return curve_->startparam(); }
00262 double endparam() const
00263 { return curve_->endparam(); }
00264
00265
00266
00271 void assureInRange(double& t);
00272
00278 virtual int knotIntervalFuzzy(double& t, double tol) const;
00279
00285 virtual double nextSegmentVal(double par, bool forward) const;
00286
00293 virtual bool isDegenerate(double epsge, int dir, double *par);
00294
00295 protected:
00296
00297
00298
00299
00300
00301
00302
00303 boost::shared_ptr<ParamCurve> curve_;
00304
00305 int dim_;
00306
00307 Param1FunctionInt *parentcurve_;
00308
00309 std::vector<std::pair<double, int> > segment_;
00310
00311
00312 mutable std::vector<double> mesh_;
00313
00314 double deg_tol_;
00315
00316
00317 private:
00318
00319 void makeMesh(int size);
00320
00321 };
00322
00323
00325 }
00326
00327
00328 #endif // _PAR1FUNCINT_H
00329
00330