//=========================================================================== // 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. //=========================================================================== 00015 #ifndef _PARAMCURVE_H 00016 #define _PARAMCURVE_H 00017 00018 #include "GoTools/utils/config.h" 00019 #include "GoTools/utils/Point.h" 00020 #include "GoTools/geometry/GeomObject.h" 00021 #include "GoTools/utils/CompositeBox.h" 00022 #include "GoTools/utils/DirectionCone.h" 00023 #include "GoTools/utils/Values.h" 00024 #include <vector> 00025 #include <boost/smart_ptr.hpp> 00026 00027 00028 namespace Go 00029 { 00030 00031 class SplineCurve; 00032 00037 class GO_API ParamCurve : public GeomObject 00038 { 00039 public: 00041 virtual ~ParamCurve(); 00042 00046 virtual void point(Point& pt, double tpar) const = 0; 00047 00059 virtual void point(std::vector<Point>& pts, 00060 double tpar, 00061 int derivs, 00062 bool from_right = true) const = 0; 00063 00064 00072 Point point(double tpar) const; 00073 00089 std::vector<Point> point(double tpar, int derivs, bool from_right = true) const; 00090 00096 virtual void uniformEvaluator(int num, std::vector<Point>& points, std::vector<double>& param) const; 00097 00100 virtual double startparam() const = 0; 00101 00104 virtual double endparam() const = 0; 00105 00112 virtual void reverseParameterDirection(bool switchparam = false) = 0; 00113 00114 virtual void setParameterInterval(double t1, double t2) = 0; 00115 00123 virtual SplineCurve* geometryCurve() = 0; 00124 00130 virtual bool isDegenerate(double degenerate_epsilon) = 0; 00131 00135 virtual bool isClosed(); 00136 00155 virtual ParamCurve* subCurve(double from_par, double to_par, 00156 double fuzzy = DEFAULT_PARAMETER_EPSILON) const = 0; 00157 00160 // #ifdef _MSC_VER 00161 // #if _MSC_VER < 1300 00162 // virtual GeomObject* clone() const = 0; 00163 // #else 00164 // virtual ParamCurve* clone() const = 0; 00165 // #endif //_MSC_VER < 1300 00166 // #else 00167 virtual ParamCurve* clone() const = 0; 00168 // #endif 00169 00174 virtual DirectionCone directionCone() const = 0; 00175 00183 virtual CompositeBox compositeBox() const; 00184 00191 virtual void appendCurve(ParamCurve* cv, bool reparam=true) = 0; 00192 00200 virtual void appendCurve(ParamCurve* cv, 00201 int continuity, double& dist, bool reparam=true) = 0; 00202 00207 double estimatedCurveLength(int numpts = 4) const; 00208 00216 double estimatedCurveLength(double tmin, double tmax, int numpts = 4) const; 00217 00231 virtual void closestPoint(const Point& pt, 00232 double tmin, 00233 double tmax, 00234 double& clo_t, 00235 Point& clo_pt, 00236 double& clo_dist, 00237 double const *seed = 0) const = 0; 00238 00248 void closestPoint(const Point& pt, double& clo_t, Point& clo_pt, double& clo_dist) const; 00249 00259 virtual double nextSegmentVal(double par, bool forward, double tol) const; 00260 00261 00266 virtual double length(double tol) = 0; 00267 00274 virtual double length(double tol, double tstart, double tend); 00275 00276 00277 protected: 00278 void closestPointGeneric(const Point& pt, 00279 double tmin, 00280 double tmax, 00281 double guess_param, 00282 double& clo_t, 00283 Point& clo_pt, 00284 double& clo_dist) const; 00285 00286 void s1771(Point pt,double aepsge, 00287 double astart,double aend,double anext,double &cpos,int *jstat) const; 00288 00289 void s1771_s9point(Point pt, std::vector<Point> val, Point diff, 00290 double astart,double aend,int max_it,double *cnext,double *ad, 00291 double adel,double *cdist,double aprev,int *jstat) const; 00292 00293 double s1771_s9del(double *eco,double *eco1,double *eco2,int idim) const; 00294 }; 00295 00296 } // namespace Go 00297 00298 00299 00300 #endif // _PARAMCURVE_H 00301