1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef GeomAlgoAPI_Circ2dBuilder_H_
22 #define GeomAlgoAPI_Circ2dBuilder_H_
24 #include <GeomAlgoAPI.h>
34 /// \class GeomAlgoAPI_Circ2dBuilder
36 /// \brief Creates circle in 2D space satisfying combination of the following constraints:
37 /// * center of a circle
38 /// * passing through the point
39 /// * tangent to a curve
41 class GeomAlgoAPI_Circ2dBuilder
44 /// \brief Create a builder object.
45 /// Constraints should be applied separately.
46 /// \param thePlane [in] plane to project tangent curves
48 GeomAlgoAPI_Circ2dBuilder(const std::shared_ptr<GeomAPI_Ax3>& thePlane);
50 /// \brief Set fixed radius of the circle
52 void setRadius(const double theRadius);
54 /// \brief Set fixed center of the circle
56 void setCenter(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter);
58 /// \brief Constrain circle to be tangent to the given edge
60 void addTangentCurve(const std::shared_ptr<GeomAPI_Shape>& theEdge);
62 /// \brief Constrain circle to pass through the given point
64 void addPassingPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
66 /// \brief Optional constraint to find circle closest to the given point
68 void setClosestPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
70 /// \brief Build circle
72 std::shared_ptr<GeomAPI_Circ2d> circle();
74 /// \brief Create a circle passing through three points
76 static std::shared_ptr<GeomAPI_Circ2d>
77 circle(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPoint,
78 const std::shared_ptr<GeomAPI_Pnt2d>& theSecondPoint,
79 const std::shared_ptr<GeomAPI_Pnt2d>& theThirdPoint);
82 std::shared_ptr<GeomAPI_Ax3> myPlane;
83 std::shared_ptr<GeomAPI_Pnt2d> myCenter;
84 std::vector< std::shared_ptr<GeomAPI_Pnt2d> > myPassingPoints;
85 std::vector< std::shared_ptr<GeomAPI_Shape> > myTangentShapes;
86 std::shared_ptr<GeomAPI_Pnt2d> myClosestPoint;