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 _PARAM2FUNCTIONINT_H
00034 #define _PARAM2FUNCTIONINT_H
00035
00036
00037 #include "ParamFunctionInt.h"
00038 #include "ParamSurface.h"
00039
00040
00041 namespace Go {
00044
00045
00046
00047 class SplineSurface;
00048
00049
00052
00053 class Param2FunctionInt : public ParamFunctionInt {
00054 public:
00058 explicit Param2FunctionInt(boost::shared_ptr<ParamSurface> surf);
00059
00064 explicit Param2FunctionInt(boost::shared_ptr<ParamSurface> surf,
00065 Param2FunctionInt *parent);
00066
00068 virtual ~Param2FunctionInt() {};
00069
00074 virtual void point(Point& res, const double *par) const
00075 { surf_->point(res, par[0], par[1]); }
00076
00088 virtual void point(std::vector<Point>& pt,
00089 const double* tpar,
00090 int der,
00091 const bool* from_right = 0,
00092 double resolution = 1.0e-12) const
00093 {
00094 if (from_right == 0) {
00095
00096 surf_->point(pt, tpar[0], tpar[1], der, true, true);
00097 } else {
00098 surf_->point(pt, tpar[0], tpar[1], der,
00099 from_right[0], from_right[1], resolution);
00100 }
00101 }
00102
00104 virtual Param2FunctionInt* getParam2FunctionInt();
00105
00107 boost::shared_ptr<ParamSurface> getParamSurface();
00109 boost::shared_ptr<const ParamSurface> getParamSurface() const;
00110
00115 boost::shared_ptr<ParamSurface>
00116 getParentParamSurface(RectDomain& domain);
00121 boost::shared_ptr<ParamSurface> getParentParamSurface();
00122
00127 virtual boost::shared_ptr<Param2FunctionInt>
00128 makeIntFunction(boost::shared_ptr<ParamSurface> surf);
00129
00131 virtual int numParams() const;
00132
00141 boost::shared_ptr<ParamCurve>
00142 getIsoCurve(double param_start, double param_end,
00143 double isoval, bool pardir_is_u) const;
00144
00147 boost::shared_ptr<ParamCurve>
00148 getConstantParameterCurve(int dir, double par);
00149
00157 virtual void getLengthAndWiggle(double *length, double *wiggle);
00158
00163 virtual bool hasInnerKnots(int pardir) const;
00164
00169 virtual bool hasCriticalVals(int pardir) const;
00170
00175 virtual bool hasCriticalValsOrKnots(int pardir) const;
00176
00180 virtual bool canDivide(int pardir);
00181
00186 virtual std::vector<double> getCriticalVals(int pardir) const;
00187
00192 virtual std::vector<double> getInnerKnotVals(int pardir,
00193 bool sort = false) const;
00194
00199 virtual std::vector<double> getCriticalValsAndKnots(int pardir) const;
00200
00205 virtual int getMeshSize(int dir);
00206
00212 virtual double paramFromMesh(int dir, int idx);
00213
00215 virtual std::vector<double>::iterator getMesh();
00216
00217
00221 virtual double startParam(int pardir) const;
00222
00226 virtual double endParam(int pardir) const;
00227
00233 virtual bool boundaryPoint(const double* par, double eps) const;
00234
00238 std::vector<double> getMima() const;
00239
00249 virtual void subdivide(int pardir, double par,
00250 std::vector<boost::
00251 shared_ptr<ParamFunctionInt> >& subdiv_objs,
00252 std::vector<boost::
00253 shared_ptr<ParamFunctionInt> >& bd_objs);
00254
00255
00256
00257
00258
00259
00264 virtual bool monotone(Point& dir, double tol=1.0e-15) const;
00265
00268 virtual CompositeBox compositeBox() const;
00269
00272 virtual void
00273 getBoundaryObjects(std::vector<boost::
00274 shared_ptr<BoundaryFunctionInt> >& bd_objs);
00275
00277 int dimension()
00278 { return dim_; }
00279
00288 double isolateDegPar(int dir, int deg_edge, double threshold);
00289
00290
00291
00298 void assureInRange(int pardir, double& t);
00299
00300
00301
00302
00310 virtual int knotIntervalFuzzy(int pardir, double& t, double tol) const;
00311
00319 virtual double nextSegmentVal(int pardir, double par, bool forward) const;
00320
00325 bool isDegenerate(double epsge, int pardir);
00326
00333 virtual bool isDegenerate(double epsge, int pardir, double* par);
00334
00337 boost::shared_ptr<ParamSurface> getSurface()
00338 { return surf_; }
00339
00342 boost::shared_ptr<const ParamSurface> getSurface() const
00343 { return surf_;}
00344
00350 void derivs(double u, double v,
00351 Point& deriv_u, Point& deriv_v) const
00352 {
00353 surf_->point(temp_point_array_, u, v, 1);
00354 deriv_u = temp_point_array_[1];
00355 deriv_v = temp_point_array_[2];
00356 }
00357
00358 protected:
00359
00360
00361 boost::shared_ptr<ParamSurface> surf_;
00362
00363
00364 int dim_;
00365
00366 Param2FunctionInt *parentfunction_;
00367
00368
00369 std::vector<std::pair<double, int> > segment_[2];
00370
00371
00372
00373 Go::SplineCurve* extractBdCurve(const Go::SplineSurface&, int bdidx,
00374 int& pardir, double& tpar) const;
00375
00376
00377
00378
00379 bool bd_deg_[4];
00380 double deg_tol_;
00381 RectDomain domain_;
00382
00383 mutable int nmesh_[2];
00384 mutable std::vector<double> mesh_;
00385
00386 mutable std::vector<Point> temp_point_array_;
00387
00388 };
00389
00390
00392 }
00393
00394
00395 #endif // _PARAM2FUNCTIONINT_H
00396
00397