Salome HOME
Merge branch 'master' into cgt/devCEA
[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   /// Return center of the circle
57   GEOMAPI_EXPORT
58   const std::shared_ptr<GeomAPI_Pnt2d> center() const;
59
60   /// Return radius of the circle
61   GEOMAPI_EXPORT
62   double radius() const;
63
64   /// Project point on line
65   GEOMAPI_EXPORT
66   const std::shared_ptr<GeomAPI_Pnt2d> project(
67       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
68
69   /** \brief Computes the parameter of a given point on a circle. The point must be
70    *         located either on the circle itself or relatively to the latter
71    *         at a distance less than the tolerance value. Return FALSE if the point
72    *         is beyond the tolerance limit or if computation fails.
73    *         Max Tolerance value is currently limited to 1.e-4
74    *  \param[in] thePoint point of origin.
75    *  \param[in] theTolerance tolerance of computation.
76    *  \param[out] theParameter resulting parameter.
77    */
78   GEOMAPI_EXPORT const bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
79                                       const double theTolerance,
80                                       double& theParameter) const;
81
82   /** \brief Returns in thePoint the point of parameter theU.
83    *  P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of the circle,
84    *  XDir the XDirection and YDir the YDirection of the circle's local coordinate system.
85    *  \param[in] theU parameter.
86    *  \param[out] thePoint resulting point.
87    */
88   GEOMAPI_EXPORT void D0(const double theU, std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
89 };
90
91 #endif
92