Salome HOME
Update movement of a circle
[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_Pnt2d;
14 class GeomAPI_Dir2d;
15
16 /**\class GeomAPI_Circ2d
17  * \ingroup DataModel
18  * \brief Circle in 2D
19  */
20
21 class GeomAPI_Circ2d : public GeomAPI_Interface
22 {
23  public:
24   /// Creation of circle defined by center point and circle radius
25   GEOMAPI_EXPORT 
26   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
27                  const std::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
28
29   /// Creation of circle defined by center point, direction and circle radius
30   GEOMAPI_EXPORT 
31   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
32                  const std::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
33
34   /// Creation of circle defined by three points lying on it
35   GEOMAPI_EXPORT
36   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPoint,
37                  const std::shared_ptr<GeomAPI_Pnt2d>& theSecondPoint,
38                  const std::shared_ptr<GeomAPI_Pnt2d>& theThirdPoint);
39
40   /// Return center of the circle
41   GEOMAPI_EXPORT 
42   const std::shared_ptr<GeomAPI_Pnt2d> center() const;
43
44   /// Return radius of the circle
45   GEOMAPI_EXPORT 
46   double radius() const;
47
48   /// Project point on line
49   GEOMAPI_EXPORT 
50   const std::shared_ptr<GeomAPI_Pnt2d> project(
51       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
52
53   /** \brief Computes the parameter of a given point on a circle. The point must be
54    *         located either on the circle itself or relatively to the latter
55    *         at a distance less than the tolerance value. Return FALSE if the point
56    *         is beyond the tolerance limit or if computation fails.
57    *         Max Tolerance value is currently limited to 1.e-4
58    *  \param[in] thePoint point of origin.
59    *  \param[in] theTolerance tolerance of computation.
60    *  \param[out] theParameter resulting parameter.
61    */
62   GEOMAPI_EXPORT const bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
63                                       const double theTolerance,
64                                       double& theParameter) const;
65
66   /** \brief Returns in thePoint the point of parameter theU.
67    *  P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of the circle,
68    *  XDir the XDirection and YDir the YDirection of the circle's local coordinate system.
69    *  \param[in] theU parameter.
70    *  \param[out] thePoint resulting point.
71    */
72   GEOMAPI_EXPORT void D0(const double theU, std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
73 };
74
75 #endif
76