//=========================================================================== // 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 _CONE_H 00016 #define _CONE_H 00017 00018 00019 #include "GoTools/geometry/ElementarySurface.h" 00020 #include "GoTools/geometry/Line.h" 00021 00022 00023 namespace Go 00024 { 00025 00026 00027 class SplineSurface; 00028 00029 00042 00043 class Cone : public ElementarySurface 00044 { 00045 public: 00048 Cone() 00049 {}; 00050 00055 Cone(double radius, Point location, Point z_axis, Point x_axis, 00056 double cone_angle); 00057 00059 virtual ~Cone(); 00060 00063 virtual void read (std::istream& is); 00066 virtual void write (std::ostream& os) const; 00067 00068 // Inherited from GeomObject 00069 virtual int dimension() const; 00070 00071 // Inherited from GeomObject 00072 virtual ClassType instanceType() const; 00073 00074 // Inherited from GeomObject 00075 static ClassType classType() 00076 { return Class_Cone; } 00077 00079 virtual BoundingBox boundingBox() const; 00080 00081 // Inherited from GeomObject 00082 virtual Cone* clone() const 00083 { return new Cone(radius_, location_, z_axis_, x_axis_, cone_angle_); } 00084 00085 00086 // --- Functions inherited from ParamSurface --- 00087 00088 const RectDomain& parameterDomain() const; 00089 00090 CurveLoop outerBoundaryLoop(double degenerate_epsilon 00091 = DEFAULT_SPACE_EPSILON) const; 00092 std::vector<CurveLoop> allBoundaryLoops(double degenerate_epsilon 00093 = DEFAULT_SPACE_EPSILON) const; 00094 00095 DirectionCone normalCone() const; 00096 DirectionCone tangentCone(bool pardir_is_u) const; 00097 00098 void point(Point& pt, double upar, double vpar) const; 00099 void point(std::vector<Point>& pts, 00100 double upar, double vpar, 00101 int derivs, 00102 bool u_from_right = true, 00103 bool v_from_right = true, 00104 double resolution = 1.0e-12) const; 00105 00106 void normal(Point& n, double upar, double vpar) const; 00107 00108 std::vector<boost::shared_ptr<ParamCurve> > 00109 constParamCurves(double parameter, bool pardir_is_u) const; 00110 00111 std::vector<boost::shared_ptr<ParamSurface> > 00112 subSurfaces(double from_upar, double from_vpar, 00113 double to_upar, double to_vpar, 00114 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00115 00116 double nextSegmentVal(int dir, double par, bool forward, double tol) const; 00117 00118 void closestPoint(const Point& pt, 00119 double& clo_u, 00120 double& clo_v, 00121 Point& clo_pt, 00122 double& clo_dist, 00123 double epsilon, 00124 const RectDomain* domain_of_interest = NULL, 00125 double *seed = 0) const; 00126 00127 void closestBoundaryPoint(const Point& pt, 00128 double& clo_u, 00129 double& clo_v, 00130 Point& clo_pt, 00131 double& clo_dist, 00132 double epsilon, 00133 const RectDomain* rd = NULL, 00134 double *seed = 0) const; 00135 00136 void getBoundaryInfo(Point& pt1, Point& pt2, 00137 double epsilon, SplineCurve*& cv, 00138 SplineCurve*& crosscv, double knot_tol = 1e-05) const; 00139 00140 void turnOrientation(); 00141 00142 void reverseParameterDirection(bool direction_is_u); 00143 00144 void swapParameterDirection(); 00145 00146 bool isDegenerate(bool& b, bool& r, 00147 bool& t, bool& l, double tolerance) const; 00148 00149 00151 virtual void getDegenerateCorners(std::vector<Point>& deg_corners, double tol) const; 00152 00153 // --- Functions specific to Cone --- 00154 00155 double getRadius() const 00156 { return radius_; } 00157 00158 Point getLocation() const 00159 { return location_; } 00160 00161 void getCoordinateAxes(Point& x_axis, Point& y_axis, Point& z_axis) const 00162 { 00163 x_axis = x_axis_; 00164 y_axis = y_axis_; 00165 z_axis = z_axis_; 00166 } 00167 00168 double getConeAngle() const 00169 { return cone_angle_; } 00170 00171 void setParameterBounds(double from_upar, double from_vpar, 00172 double to_upar, double to_vpar); 00173 00177 bool isBounded() const; 00178 00179 Cone* subSurface(double from_upar, double from_vpar, 00180 double to_upar, double to_vpar, 00181 double fuzzy = DEFAULT_PARAMETER_EPSILON) const; 00182 00183 virtual SplineSurface* geometrySurface() const; 00184 00185 boost::shared_ptr<Line> getLine(double upar) const; 00186 00187 protected: 00188 00189 double radius_; 00190 Point location_; 00191 Point z_axis_; 00192 Point x_axis_; 00193 Point y_axis_; 00194 double cone_angle_; 00195 00196 RectDomain domain_; 00197 00198 void setCoordinateAxes(); 00199 00200 }; 00201 00202 } // namespace Go 00203 00204 00205 #endif // _CONE_H 00206