CurveOnSurface.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools version 1.1
00003 //
00004 // GoTools module: CORE
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 _GOCURVEONSURFACE_H
00034 #define _GOCURVEONSURFACE_H
00035 
00036 #include "ParamSurface.h"
00037 #include "ParamCurve.h"
00038 #include <boost/smart_ptr.hpp>
00039 
00040 
00041 namespace Go
00042 {
00045 
00046 
00047 class SplineCurve;
00048 
00053 class CurveOnSurface : public ParamCurve
00054 {
00055 public:
00058     CurveOnSurface();
00059 
00072     CurveOnSurface(boost::shared_ptr<ParamSurface> surf,
00073                      boost::shared_ptr<ParamCurve> curve,
00074                      bool preferparameter);
00075     
00087     CurveOnSurface(boost::shared_ptr<ParamSurface> surf,
00088                      boost::shared_ptr<ParamCurve> pcurve,
00089                      boost::shared_ptr<ParamCurve> spacecurve,
00090                      bool preferparameter);
00091 
00095     CurveOnSurface(const CurveOnSurface& surface_curve);
00096 
00100     CurveOnSurface& operator= (const CurveOnSurface& other);
00101     
00104     virtual ~CurveOnSurface();
00105 
00106 
00107     // inherited from Streamable
00108     virtual void read (std::istream& is);
00109     virtual void write (std::ostream& os) const;
00110 
00111     // inherited from GeomObject
00112     // @afr: This one only returns the bounding box of the underlying surface
00113     virtual BoundingBox boundingBox() const;
00114     virtual DirectionCone directionCone() const;
00115     virtual int dimension() const;
00116     virtual ClassType instanceType() const;
00117     static ClassType classType()
00118     { return Class_CurveOnSurface; }
00119     
00120     // The function clone() calls the copy constructor,
00121     // so clone() also makes deep copies of the curves,
00122     // but not the underlying surface.
00123 // #ifdef _MSC_VER
00124 // #if _MSC_VER < 1300
00125 //     virtual GeomObject* clone() const
00126 //       { return new CurveOnSurface(*this); }
00127 // #else
00128 //     virtual CurveOnSurface* clone() const
00129 //       { return new CurveOnSurface(*this); }
00130 // #endif // _MSC_VER < 1300
00131 // #else
00132     virtual CurveOnSurface* clone() const
00133     { return new CurveOnSurface(*this); }
00134 // #endif
00135 
00136     // inherited from ParamCurve
00137     virtual void point(Point& pt, double tpar) const;
00138 
00141     virtual void point(std::vector<Point>& pts, 
00142                        double tpar,
00143                        int derivs, bool from_right = true) const;
00144     
00145     // inherited from ParamCurve
00146     virtual double startparam() const;
00147 
00148     // inherited from ParamCurve
00149     virtual double endparam() const;
00150 
00151     // inherited from ParamCurve
00152     virtual void reverseParameterDirection(bool switchparam = false);
00153 
00154     // inherited from ParamCurve
00155     virtual SplineCurve* geometryCurve();
00156 
00157     // inherited from ParamCurve
00158     virtual bool isDegenerate(double degenerate_epsilon);
00159 
00160 
00161 // #if ((_MSC_VER > 0) && (_MSC_VER < 1300))
00162 //     // inherited from ParamCurve
00163 //     virtual ParamCurve* subCurve(double from_par, double to_par,
00164 //                                 double fuzzy = DEFAULT_PARAMETER_EPSILON) const;
00165 // #else
00166     // inherited from ParamCurve
00167     virtual CurveOnSurface* subCurve(double from_par, double to_par,
00168                                        double fuzzy =
00169                                        DEFAULT_PARAMETER_EPSILON) const;
00170 // #endif
00171 
00172     // inherited from ParamCurve
00173     virtual void closestPoint(const Point& pt,
00174                               double         tmin,
00175                               double         tmax,
00176                               double&        clo_t,
00177                               Point&       clo_pt,
00178                               double&        clo_dist,
00179                               double const   *seed = 0) const;
00180 
00181     // inherited from ParamCurve.  NB: does not check whether the resulting ParamCurve
00182     // stays inside parameter domain (or that the space curve stays on surface).
00183     virtual void appendCurve(ParamCurve* cv, bool reparam=true);
00184 
00185     // inherited from ParamCurve.  NB: does not check whether the resulting ParamCurve
00186     // stays inside parameter domain (or that the space curve stays on surface).
00187     virtual void appendCurve(ParamCurve* cv,
00188                              int continuity, double& dist, bool reparam=true);
00189 
00193     void setUnderlyingSurface(boost::shared_ptr<ParamSurface> surface)
00194     {surface_ = surface;}
00195 
00201     virtual double nextSegmentVal(double par, bool forward, double tol) const;
00202 
00203 
00206     boost::shared_ptr<ParamSurface> underlyingSurface()
00207     { return surface_; }
00208 
00211     boost::shared_ptr<ParamCurve> parameterCurve()
00212     { return pcurve_; }
00213 
00216     boost::shared_ptr<ParamCurve> spaceCurve()
00217     { return spacecurve_; }
00218 
00221     boost::shared_ptr<const ParamSurface> underlyingSurface() const
00222     { return surface_; }
00223 
00226     boost::shared_ptr<const ParamCurve> parameterCurve() const
00227     { return pcurve_; }
00228 
00231     boost::shared_ptr<const ParamCurve> spaceCurve() const
00232     { return spacecurve_; }
00233     
00236     bool parPref() const
00237     { return prefer_parameter_; }
00238 
00241     RectDomain containingDomain() const;
00242 
00243 private:
00245     boost::shared_ptr<ParamSurface> surface_;
00247           // May point to null.
00248     boost::shared_ptr<ParamCurve> pcurve_;
00249     // An instance of the curve in the surface. May point to null.
00250     boost::shared_ptr<ParamCurve> spacecurve_;
00251     // Which representation to prefer if both exist
00252     bool prefer_parameter_;
00253 };
00254 
00255 
00257 } // namespace Go
00258 
00259 #endif // _GOCURVEONSURFACE_H
00260 
00261 

Generated on Mon Jun 11 14:48:18 2007 for GoTools Core Library by  doxygen 1.5.1