Salome HOME
6aad6126f0cde191e4e3b80b3d5acad542e0e708
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Circ2dBuilder.h
1 // Copyright (C) 2017-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Circ2dBuilder.h
4 // Created:     3 April 2017
5 // Author:      Artem ZHIDKOV
6
7 #ifndef GeomAlgoAPI_Circ2dBuilder_H_
8 #define GeomAlgoAPI_Circ2dBuilder_H_
9
10 #include <GeomAlgoAPI.h>
11
12 #include <memory>
13 #include <vector>
14
15 class GeomAPI_Ax3;
16 class GeomAPI_Circ2d;
17 class GeomAPI_Pnt2d;
18 class GeomAPI_Shape;
19
20 /// \class GeomAlgoAPI_Circ2dBuilder
21 /// \ingroup DataAlgo
22 /// \brief Creates circle in 2D space satisfying combination of the following constraints:
23 ///        * center of a circle
24 ///        * passing through the point
25 ///        * tangent to a curve
26 ///        * fixed radius
27 class GeomAlgoAPI_Circ2dBuilder
28 {
29 public:
30   /// \brief Create a builder object.
31   ///        Constraints should be applied separately.
32   /// \param thePlane [in]  plane to project tangent curves
33   GEOMALGOAPI_EXPORT
34   GeomAlgoAPI_Circ2dBuilder(const std::shared_ptr<GeomAPI_Ax3>& thePlane);
35
36   /// \brief Set fixed radius of the circle
37   GEOMALGOAPI_EXPORT
38   void setRadius(const double theRadius);
39
40   /// \brief Set fixed center of the circle
41   GEOMALGOAPI_EXPORT
42   void setCenter(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter);
43
44   /// \brief Constrain circle to be tangent to the given edge
45   GEOMALGOAPI_EXPORT
46   void addTangentCurve(const std::shared_ptr<GeomAPI_Shape>& theEdge);
47
48   /// \brief Constrain circle to pass through the given point
49   GEOMALGOAPI_EXPORT
50   void addPassingPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
51
52   /// \brief Optional constraint to find circle closest to the given point
53   GEOMALGOAPI_EXPORT
54   void setClosestPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
55
56   /// \brief Build circle
57   GEOMALGOAPI_EXPORT
58   std::shared_ptr<GeomAPI_Circ2d> circle();
59
60   /// \brief Create a circle passing through three points
61   GEOMALGOAPI_EXPORT
62   static std::shared_ptr<GeomAPI_Circ2d>
63       circle(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPoint,
64              const std::shared_ptr<GeomAPI_Pnt2d>& theSecondPoint,
65              const std::shared_ptr<GeomAPI_Pnt2d>& theThirdPoint);
66
67 private:
68   std::shared_ptr<GeomAPI_Ax3>                  myPlane;
69   std::shared_ptr<GeomAPI_Pnt2d>                myCenter;
70   std::vector< std::shared_ptr<GeomAPI_Pnt2d> > myPassingPoints;
71   std::vector< std::shared_ptr<GeomAPI_Shape> > myTangentShapes;
72   std::shared_ptr<GeomAPI_Pnt2d>                myClosestPoint;
73   double                                        myRadius;
74 };
75
76 #endif