//=========================================================================== // 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 _CIRCLE_H 00016 #define _CIRCLE_H 00017 00018 00019 #include "GoTools/geometry/ElementaryCurve.h" 00020 00021 00022 namespace Go { 00023 00024 00033 00034 class Circle : public ElementaryCurve 00035 { 00036 public: 00039 Circle() 00040 {}; 00041 00045 Circle(double radius, 00046 Point centre, Point normal, Point x_axis); 00047 00049 virtual ~Circle(); 00050 00053 virtual void read (std::istream& is); 00056 virtual void write (std::ostream& os) const; 00057 00058 00059 // --- Functions inherited from GeomObject --- 00060 00061 virtual BoundingBox boundingBox() const; 00062 00063 virtual int dimension() const; 00064 00065 virtual ClassType instanceType() const; 00066 00067 static ClassType classType(); 00068 00069 virtual Circle* clone() const; 00070 00071 // --- Functions inherited from ParamCurve --- 00072 00073 virtual void point(Point& pt, double tpar) const; 00074 00075 virtual void point(std::vector<Point>& pts, 00076 double tpar, 00077 int derivs, 00078 bool from_right = true) const; 00079 00080 virtual double startparam() const; 00081 virtual double endparam() const; 00082 00083 virtual void reverseParameterDirection(bool switchparam = false); 00084 00085 // Circle parametrized on [0, 2*M_PI). Allowing class to be 00086 // defined on a section of the circle. 00087 virtual void setParameterInterval(double t1, double t2); 00088 00095 virtual SplineCurve* geometryCurve(); 00096 00097 virtual bool isDegenerate(double degenerate_epsilon); 00098 00099 virtual bool isClosed(); 00100 00101 virtual 00102 Circle* subCurve(double from_par, double to_par, 00103 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00104 00105 virtual DirectionCone directionCone() const; 00106 00107 virtual void appendCurve(ParamCurve* cv, bool reparam=true); 00108 00109 virtual void appendCurve(ParamCurve* cv, 00110 int continuity, double& dist, bool reparam=true); 00111 00112 virtual void closestPoint(const Point& pt, 00113 double tmin, 00114 double tmax, 00115 double& clo_t, 00116 Point& clo_pt, 00117 double& clo_dist, 00118 double const *seed = 0) const; 00119 00120 virtual double length(double tol); 00121 00122 // --- Functions specific to Circle --- 00123 00132 void setParamBounds(double startpar, double endpar); 00133 00134 00135 protected: 00136 00137 double radius_; 00138 Point centre_; 00139 Point normal_; 00140 Point vec1_; 00141 Point vec2_; 00142 00143 double startparam_; 00144 double endparam_; 00145 00146 void setSpanningVectors(); 00147 }; 00148 00149 00150 } // namespace Go 00151 00152 00153 #endif // _CIRCLE_H 00154