ParamCurveInt.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools
00003 //
00004 // GoTools module: Intersections, version 1.0
00005 //
00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program is distributed in the hope that it will be useful,        
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of         
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          
00015 // GNU General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
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     // Functions used from coincidence checking
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     // Data members
00347     boost::shared_ptr<ParamCurve> curve_;
00348 
00349     int dim_; // Space dimension.
00350 
00351     std::vector<std::pair<double, int> > segment_;
00352 
00353     // Approximating polygon
00354     mutable std::vector<double> mesh_;
00355 
00356     mutable bool lw_set_;
00357     mutable double length_, wiggle_;
00358 
00359 private:
00360     // Make approximating polygon
00361     void makeMesh(int size) const;
00362 
00363 };
00364 
00365 
00367 } // namespace Go
00368 
00369 
00370 #endif // _PARAMCURVEINT_H
00371 

Generated on Fri Nov 23 12:24:33 2007 for GoTools Intersections Library by  doxygen 1.5.1