//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //===========================================================================
00001 #ifndef _PROJECTCURVE_ 00002 #define _PROJECTCURVE_ 00003 00004 #include <boost/smart_ptr.hpp> 00005 00006 #include "GoTools/utils/Point.h" 00007 #include "GoTools/creators/EvalCurve.h" 00008 #include "GoTools/geometry/SplineCurve.h" 00009 #include "GoTools/geometry/SplineSurface.h" 00010 00011 00012 namespace Go 00013 { 00014 00017 00018 class ProjectCurve : public EvalCurve 00019 { 00020 public: 00021 00040 ProjectCurve(boost::shared_ptr<Go::ParamCurve>& space_crv, 00041 boost::shared_ptr<Go::ParamSurface>& surf, 00042 boost::shared_ptr<Go::Point>& start_par_pt, 00043 boost::shared_ptr<Go::Point>& end_par_pt, 00044 double epsgeo1, 00045 // double epsgeo2, 00046 const RectDomain* domain_of_interest = NULL); 00047 00049 virtual ~ProjectCurve(); 00050 00051 // Inherited from EvalCurve 00052 virtual Go::Point eval( double t) const; 00053 00054 Go::Point eval( double t, Go::Point seed) const; 00055 00056 // Inherited from EvalCurve 00057 virtual void eval(double t, int n, Go::Point der[]) const; 00058 00059 // Inherited from EvalCurve 00060 virtual double start() const; 00061 00062 // Inherited from EvalCurve 00063 virtual double end() const; 00064 00067 virtual int dim() const; 00068 00079 virtual bool approximationOK(double par, Go::Point approxpos, 00080 double tol1, double tol2) const; 00081 00082 private: 00083 const boost::shared_ptr<Go::ParamCurve> space_crv_; 00084 const boost::shared_ptr<Go::ParamSurface> surf_; 00085 const boost::shared_ptr<Go::Point> start_par_pt_; // When projecting end pts may be of special interest. 00086 const boost::shared_ptr<Go::Point> end_par_pt_; 00087 // We store our found proj pts, useful for seed creation. 00088 // vector<pair<double, Point> > found_pts_; // (cv_par, sf_par) 00089 const double epsgeo1_; // Max dist from exact proj. 00090 // const double epsgeo2_; // Max dist from space_crv. Negative = ignored. 00091 const RectDomain* domain_of_interest_; 00092 bool closed_dir_u_; // Closed cfs and projection requires extra caution. 00093 bool closed_dir_v_; 00094 double umin_, umax_, vmin_, vmax_; // Parameter domain of surface 00095 00096 // Simple function, interpolates and pts. 00097 std::vector<double> createSeed(double tpar) const; 00098 00099 void surfaceClosed(const SplineSurface& sf, bool& dir_u, bool& dir_v) const; 00100 00101 // Assuming surface is closed, make sure we landed on the right 00102 // side. 00103 void placeBorderPoint(double t, 00104 double& clo_u, double& clo_v) const; 00105 00106 00107 }; 00108 00109 00110 } 00111 00112 #endif //_PROJECTCURVE_