//=========================================================================== // 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 _BOUNDEDCURVE_H 00016 #define _BOUNDEDCURVE_H 00017 00018 00019 #include "GoTools/geometry/ParamCurve.h" 00020 00021 00022 // Both parameter values and end points may be given to define the 00023 // boundaries. Assuming that both points prefer parameter, or both 00024 // points prefer points. 00025 00026 namespace Go 00027 { 00028 00029 class GO_API BoundedCurve : public ParamCurve 00030 { 00031 public: 00032 00035 BoundedCurve() 00036 {}; 00037 00040 BoundedCurve(boost::shared_ptr<ParamCurve> curve, bool prefer_bd_par, 00041 double start_par, double end_par, 00042 Point start_pt, Point end_pt); 00043 00044 BoundedCurve(boost::shared_ptr<ParamCurve> curve, 00045 Point start_pt, Point end_pt); 00046 00047 BoundedCurve(boost::shared_ptr<ParamCurve> curve, 00048 double start_par, double end_par); 00049 00051 virtual ~BoundedCurve(); 00052 00055 virtual void read (std::istream& is); 00058 virtual void write (std::ostream& os) const; 00059 00060 00061 // --- Functions inherited from GeomObject --- 00062 00063 virtual BoundingBox boundingBox() const; 00064 00065 virtual int dimension() const; 00066 00067 virtual ClassType instanceType() const; 00068 00069 static ClassType classType(); 00070 00071 virtual BoundedCurve* clone() const; 00072 00073 // --- Functions inherited from ParamCurve --- 00074 00075 virtual void point(Point& pt, double tpar) const; 00076 00077 virtual void point(std::vector<Point>& pts, 00078 double tpar, 00079 int derivs, 00080 bool from_right = true) const; 00081 00082 virtual double startparam() const; 00083 virtual double endparam() const; 00084 00085 virtual void reverseParameterDirection(bool switchparam = false); 00086 00087 virtual void setParameterInterval(double t1, double t2); 00088 00089 virtual SplineCurve* geometryCurve(); 00090 00091 virtual bool isDegenerate(double degenerate_epsilon); 00092 00093 virtual 00094 BoundedCurve* subCurve(double from_par, double to_par, 00095 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00096 00097 virtual DirectionCone directionCone() const; 00098 00099 virtual void appendCurve(ParamCurve* cv, bool reparam=true); 00100 00101 virtual void appendCurve(ParamCurve* cv, 00102 int continuity, double& dist, bool reparam=true); 00103 00104 virtual void closestPoint(const Point& pt, 00105 double tmin, 00106 double tmax, 00107 double& clo_t, 00108 Point& clo_pt, 00109 double& clo_dist, 00110 double const *seed = 0) const; 00111 00112 virtual double length(double tol); 00113 00117 void setParamBounds(double startpar, double endpar); 00118 00119 private: 00120 boost::shared_ptr<ParamCurve> curve_; 00121 00122 bool prefer_parameter_; // As opposed to points. 00123 00124 double startparam_; 00125 double endparam_; 00126 Point start_pt_; 00127 Point end_pt_; 00128 00129 // // Also give an orientation? 00130 // bool opp_dir_; 00131 00132 }; 00133 00134 00135 } // namespace Go 00136 00137 00138 #endif // _BOUNDEDCURVE_H 00139