Param0FunctionInt.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 _PARAM0FUNCTIONINT_H
00034 #define _PARAM0FUNCTIONINT_H
00035 
00036 
00037 #include "ParamFunctionInt.h"
00038 
00039 
00040 namespace Go {
00043 
00044 
00045 
00048 
00049 class Param0FunctionInt : public ParamFunctionInt {
00050 public:
00053     explicit Param0FunctionInt(double C);
00054 
00058     explicit Param0FunctionInt(double C,
00059                                ParamFunctionInt *parent);
00060 
00062     virtual ~Param0FunctionInt();
00063 
00068     virtual void point(Point& res, const double *par) const;
00069 
00081     virtual void point(std::vector<Point>& pt, 
00082                        const double* tpar, 
00083                        int derivs,  
00084                        const bool* from_right = 0,
00085                        double resolution = 1.0e-12) const
00086     {
00087         DEBUG_ERROR_IF(derivs != 0,
00088                        "Asked for derivatives of a standalone point.");
00089         pt.resize(1);
00090         point(pt[0], tpar);
00091     }
00092 
00094     virtual Param0FunctionInt* getParam0FunctionInt();
00095 
00097     virtual int numParams() const;
00098 
00106     virtual void getLengthAndWiggle(double *length, double *wiggle);
00107 
00112     virtual bool hasInnerKnots(int pardir) const;
00113 
00118     virtual std::vector<double> getInnerKnotVals(int pardir,
00119                                                  bool sort = false) const;
00120 
00125     virtual bool hasCriticalVals(int pardir) const;
00126 
00131     virtual std::vector<double> getCriticalVals(int pardir) const;
00132 
00137     virtual bool hasCriticalValsOrKnots(int pardir) const;
00138 
00143     virtual std::vector<double> getCriticalValsAndKnots(int pardir) const;
00144 
00148     virtual bool canDivide(int pardir);
00149 
00154     virtual int getMeshSize(int dir);
00155 
00161     virtual double paramFromMesh(int dir, int idx);
00162 
00164     virtual std::vector<double>::iterator getMesh();
00165 
00169     virtual double startParam(int pardir) const;
00170 
00174     virtual double endParam(int pardir) const;
00175 
00181     virtual bool boundaryPoint(const double* par, double eps) const;
00182 
00192     virtual void subdivide(int pardir, double par, 
00193                            std::vector<boost::
00194                            shared_ptr<ParamFunctionInt> >& subdiv_objs,
00195                            std::vector<boost::
00196                            shared_ptr<ParamFunctionInt> >& bd_objs);
00197 
00199     virtual CompositeBox compositeBox() const;
00200 
00204 
00205     // The returned dir is of interest for the 2par-case only.
00206     // Accepts non-strict monotonicity, as long as sf is not totally flat.
00207     virtual bool monotone(Point& dir, double tol=1.0e-15) const; // = 0;
00208 
00211     virtual void
00212     getBoundaryObjects(std::vector<boost::
00213                        shared_ptr<BoundaryFunctionInt> >& bd_objs);
00214 
00216     int dimension();
00217 
00218     // Functions used from coincidence checking
00219  
00220     // Find the interval in which t lies, if t is within tol of an
00221     // existing knot, t will be changed to that knot.
00222 
00228     virtual int knotIntervalFuzzy(double& t, double tol) const;
00229     
00234     virtual double nextSegmentVal(double par, bool forward) const;
00235 
00237     double getValue() const
00238     { return C_; }
00239 
00240 protected:
00241 
00242     double C_; // The 0-parameter "function".
00243 
00244     int dim_; // Space dimension. 1.
00245 
00246     ParamFunctionInt* parentcurve_; // @@sbr Or surface ...
00247 
00248 };
00249 
00250 
00252 } // namespace Go
00253 
00254 
00255 #endif // _PARAM0FUNCTIONINT_H
00256 
00257 

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