Salome HOME
Cleanup code of SketchPlugin_Fillet feature. Move calculation of tangent circle to...
[modules/shaper.git] / src / GeomAPI / GeomAPI_Circ2d.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Circ2d.h
4 // Created:     29 May 2014
5 // Author:      Artem ZHIDKOV
6
7 #ifndef GeomAPI_Circ2d_H_
8 #define GeomAPI_Circ2d_H_
9
10 #include <GeomAPI_Interface.h>
11 #include <memory>
12
13 class GeomAPI_Ax3;
14 class GeomAPI_Pnt2d;
15 class GeomAPI_Dir2d;
16 class GeomAPI_Shape;
17
18 /**\class GeomAPI_Circ2d
19  * \ingroup DataModel
20  * \brief Circle in 2D
21  */
22
23 class GeomAPI_Circ2d : public GeomAPI_Interface
24 {
25  public:
26   /// Creation of circle defined by center point and circle radius
27   GEOMAPI_EXPORT
28   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
29                  const std::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
30
31   /// Creation of circle defined by center point, direction and circle radius
32   GEOMAPI_EXPORT
33   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
34                  const std::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
35
36   /// Creation of circle defined by three points lying on it
37   GEOMAPI_EXPORT
38   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPoint,
39                  const std::shared_ptr<GeomAPI_Pnt2d>& theSecondPoint,
40                  const std::shared_ptr<GeomAPI_Pnt2d>& theThirdPoint);
41
42   /// Creation of a circle defined by center and a tangent curve on the given plane
43   GEOMAPI_EXPORT
44   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
45                  const std::shared_ptr<GeomAPI_Shape>& theTangent,
46                  const std::shared_ptr<GeomAPI_Ax3>&   thePlane);
47
48   /// Creation of a circle passing through or tangent to given entities.
49   /// Supported items are GeomAPI_Pnt2d or GeomAPI_Shape
50   GEOMAPI_EXPORT
51   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Interface>& theEntity1,
52                  const std::shared_ptr<GeomAPI_Interface>& theEntity2,
53                  const std::shared_ptr<GeomAPI_Interface>& theEntity3,
54                  const std::shared_ptr<GeomAPI_Ax3>&       thePlane);
55
56   /// Creation of a circle with given radius passing through or tangent to two entities.
57   /// Supported items are GeomAPI_Pnt2d or GeomAPI_Shape
58   GEOMAPI_EXPORT
59   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Interface>& theEntity1,
60                  const std::shared_ptr<GeomAPI_Interface>& theEntity2,
61                  const double                              theRadius,
62                  const std::shared_ptr<GeomAPI_Ax3>&       thePlane);
63
64   /// Return center of the circle
65   GEOMAPI_EXPORT
66   const std::shared_ptr<GeomAPI_Pnt2d> center() const;
67
68   /// Return radius of the circle
69   GEOMAPI_EXPORT
70   double radius() const;
71
72   /// Project point on line
73   GEOMAPI_EXPORT
74   const std::shared_ptr<GeomAPI_Pnt2d> project(
75       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
76
77   /** \brief Computes the parameter of a given point on a circle. The point must be
78    *         located either on the circle itself or relatively to the latter
79    *         at a distance less than the tolerance value. Return FALSE if the point
80    *         is beyond the tolerance limit or if computation fails.
81    *         Max Tolerance value is currently limited to 1.e-4
82    *  \param[in] thePoint point of origin.
83    *  \param[in] theTolerance tolerance of computation.
84    *  \param[out] theParameter resulting parameter.
85    */
86   GEOMAPI_EXPORT const bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
87                                       const double theTolerance,
88                                       double& theParameter) const;
89
90   /** \brief Returns in thePoint the point of parameter theU.
91    *  P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of the circle,
92    *  XDir the XDirection and YDir the YDirection of the circle's local coordinate system.
93    *  \param[in] theU parameter.
94    *  \param[out] thePoint resulting point.
95    */
96   GEOMAPI_EXPORT void D0(const double theU, std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
97 };
98
99 #endif
100