//=========================================================================== // 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 _LINE_H 00016 #define _LINE_H 00017 00018 00019 #include "GoTools/geometry/ElementaryCurve.h" 00020 00021 00022 namespace Go { 00023 00024 00031 00032 class Line : public ElementaryCurve 00033 { 00034 public: 00037 Line() 00038 {}; 00039 00043 Line(Point point, Point direction); 00044 00046 virtual ~Line(); 00047 00050 virtual void read (std::istream& is); 00053 virtual void write (std::ostream& os) const; 00054 00055 00056 // --- Functions inherited from GeomObject --- 00057 00058 virtual BoundingBox boundingBox() const; 00059 00060 virtual int dimension() const; 00061 00062 virtual ClassType instanceType() const; 00063 00064 static ClassType classType(); 00065 00066 virtual Line* clone() const; 00067 00068 // --- Functions inherited from ParamCurve --- 00069 00070 virtual void point(Point& pt, double tpar) const; 00071 00072 virtual void point(std::vector<Point>& pts, 00073 double tpar, 00074 int derivs, 00075 bool from_right = true) const; 00076 00077 virtual double startparam() const; 00078 virtual double endparam() const; 00079 00080 virtual void reverseParameterDirection(bool switchparam = false); 00081 00082 virtual void setParameterInterval(double t1, double t2); 00083 00084 virtual SplineCurve* geometryCurve(); 00085 00086 virtual bool isDegenerate(double degenerate_epsilon); 00087 00088 virtual 00089 Line* subCurve(double from_par, double to_par, 00090 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00091 00092 virtual DirectionCone directionCone() const; 00093 00094 virtual void appendCurve(ParamCurve* cv, bool reparam=true); 00095 00096 virtual void appendCurve(ParamCurve* cv, 00097 int continuity, double& dist, bool reparam=true); 00098 00099 virtual void closestPoint(const Point& pt, 00100 double tmin, 00101 double tmax, 00102 double& clo_t, 00103 Point& clo_pt, 00104 double& clo_dist, 00105 double const *seed = 0) const; 00106 00107 virtual double length(double tol); 00108 00109 // --- Functions specific to Line --- 00110 00114 void setParamBounds(double startpar, double endpar); 00115 00119 bool isBounded(); 00120 00121 protected: 00122 00123 Point location_; 00124 Point dir_; 00125 00126 double startparam_; 00127 double endparam_; 00128 00129 }; 00130 00131 00132 } // namespace Go 00133 00134 00135 #endif // _LINE_H 00136