Salome HOME
Reverted some changes in salome build/run scripts.
[modules/shaper.git] / src / GeomAPI / GeomAPI_Circ2d.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef GeomAPI_Circ2d_H_
22 #define GeomAPI_Circ2d_H_
23
24 #include <GeomAPI_Interface.h>
25 #include <memory>
26
27 class GeomAPI_Ax3;
28 class GeomAPI_Pnt2d;
29 class GeomAPI_Dir2d;
30 class GeomAPI_Shape;
31
32 /**\class GeomAPI_Circ2d
33  * \ingroup DataModel
34  * \brief Circle in 2D
35  */
36
37 class GeomAPI_Circ2d : public GeomAPI_Interface
38 {
39  public:
40   /// Creation of circle defined by center point and circle radius
41   GEOMAPI_EXPORT
42   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
43                  const std::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
44
45   /// Creation of circle defined by center point, direction and circle radius
46   GEOMAPI_EXPORT
47   GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
48                  const std::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
49
50   /// Return center of the circle
51   GEOMAPI_EXPORT
52   const std::shared_ptr<GeomAPI_Pnt2d> center() const;
53
54   /// Return radius of the circle
55   GEOMAPI_EXPORT
56   double radius() const;
57
58   /// Project point on line
59   GEOMAPI_EXPORT
60   const std::shared_ptr<GeomAPI_Pnt2d> project(
61       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
62
63   /** \brief Computes the parameter of a given point on a circle. The point must be
64    *         located either on the circle itself or relatively to the latter
65    *         at a distance less than the tolerance value. Return FALSE if the point
66    *         is beyond the tolerance limit or if computation fails.
67    *         Max Tolerance value is currently limited to 1.e-4
68    *  \param[in] thePoint point of origin.
69    *  \param[in] theTolerance tolerance of computation.
70    *  \param[out] theParameter resulting parameter.
71    */
72   GEOMAPI_EXPORT const bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
73                                       const double theTolerance,
74                                       double& theParameter) const;
75
76   /** \brief Returns in thePoint the point of parameter theU.
77    *  P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of the circle,
78    *  XDir the XDirection and YDir the YDirection of the circle's local coordinate system.
79    *  \param[in] theU parameter.
80    *  \param[out] thePoint resulting point.
81    */
82   GEOMAPI_EXPORT void D0(const double theU, std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
83 };
84
85 #endif
86