1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef GeomAPI_Edge_H_
21 #define GeomAPI_Edge_H_
23 #include <GeomAPI_Shape.h>
29 class GeomAPI_Ellipse;
31 /**\class GeomAPI_Edge
33 * \brief Interface to the edge object
36 class GeomAPI_Edge : public GeomAPI_Shape
39 /// Makes an undefined Edge (no geometry).
43 /// Creation of edge by the edge-shape
45 GeomAPI_Edge(const std::shared_ptr<GeomAPI_Shape>& theShape);
47 /// Verifies that the edge is a line
51 /// Verifies that the edge is a circle
53 bool isCircle() const;
55 /// Verifies that the edge is an arc of circle
59 /// Verifies that the edge is an arc of circle
61 bool isEllipse() const;
63 /// Returns the first vertex coordinates of the edge
65 std::shared_ptr<GeomAPI_Pnt> firstPoint();
67 /// Returns the Last vertex coordinates of the edge
69 std::shared_ptr<GeomAPI_Pnt> lastPoint();
71 /// Returns a circle if edge is based on the circle curve
73 std::shared_ptr<GeomAPI_Circ> circle() const;
75 /// Returns an ellipse if edge is based on the ellipse curve
77 std::shared_ptr<GeomAPI_Ellipse> ellipse() const;
79 /// Returns a line if edge is based on the linear curve
81 std::shared_ptr<GeomAPI_Lin> line() const;
83 /// Returns true if the current edge is geometrically equal to the given edge
85 bool isEqual(const std::shared_ptr<GeomAPI_Shape> theEdge) const;
87 /// Returns range of parameter on the curve
89 void getRange(double& theFirst, double& theLast) const;
91 /// Returns true, if the edge is fully placed in the specified plane
92 /// \param thePlane a plane for intersection
94 bool isInPlane(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
96 /// Returns list of intersection points if the edge has intersections with the given plane
97 /// \param thePlane a plane for intersection
99 void intersectWithPlane(const std::shared_ptr<GeomAPI_Pln> thePlane,
100 std::list<std::shared_ptr<GeomAPI_Pnt> >& theResult) const;
102 /// Returns edge length.
104 double length() const;
106 /// Returns true if the edge is closed (like full circle)
108 bool isClosed() const;
110 /// Returns true if the edge is degenerated (has no 3D curve)
112 bool isDegenerated() const;
115 void setFirstPointTolerance(const double theTolerance);
118 void setLastPointTolerance(const double theTolerance);
120 /// Return middle point on the edge
122 virtual std::shared_ptr<GeomAPI_Pnt> middlePoint() const;
125 //! Pointer on object
126 typedef std::shared_ptr<GeomAPI_Edge> GeomEdgePtr;