Salome HOME
Issue #2208: positioning of tangent and perpendicular symbols
[modules/shaper.git] / src / GeomAPI / GeomAPI_Circ.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_Circ_H_
22 #define GeomAPI_Circ_H_
23
24 #include <GeomAPI_Interface.h>
25 #include <GeomAPI_Curve.h>
26 #include <memory>
27
28 class GeomAPI_Ax2;
29 class GeomAPI_Pnt;
30 class GeomAPI_Dir;
31
32 /**\class GeomAPI_Circ
33  * \ingroup DataModel
34  * \brief Circle in 3D
35  */
36
37 class GeomAPI_Circ : public GeomAPI_Interface
38 {
39  public:
40
41   /** \brief Constructs a circle of radius Radius, where theAx2 locates
42    *  the circle and defines its orientation in 3D space such that:\n
43    *  - the center of the circle is the origin of theAx2;\n
44    *  - the origin, "X Direction" and "Y Direction" of theAx2 define the plane of the circle;\n
45    *  - theAx2 is the local coordinate system of the circle.\n
46    *    Note: It is possible to create a circle where Radius is equal to 0.0. raised if Radius < 0.
47    */
48   GEOMAPI_EXPORT GeomAPI_Circ(const std::shared_ptr<GeomAPI_Ax2> theAx2,
49                               const double theRadius);
50
51   /// Creation of circle defined by center point, direction and circle radius
52   GEOMAPI_EXPORT GeomAPI_Circ(const std::shared_ptr<GeomAPI_Pnt>& theCenter,
53                const std::shared_ptr<GeomAPI_Dir>& theDir, double theRadius);
54
55   /// Creation of circle defined by a curve
56   GEOMAPI_EXPORT GeomAPI_Circ(const GeomCurvePtr& theCurve);
57
58   /// Return center of the circle
59   GEOMAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt> center() const;
60
61   /// Return radius of the circle
62   GEOMAPI_EXPORT double radius() const;
63
64   /// Return orthogonal direction to the circle's plane
65   GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> normal() const;
66
67   /// Project point on circle
68   GEOMAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt> project(
69       const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
70
71   /** \brief Computes the parameter of a given point on a circle. The point must be
72    *         located either on the circle itself or relatively to the latter
73    *         at a distance less than the tolerance value. Return FALSE if the point
74    *         is beyond the tolerance limit or if computation fails.
75    *         Max Tolerance value is currently limited to 1.e-4
76    *  \param[in] thePoint point of origin.
77    *  \param[in] theTolerance tolerance of computation.
78    *  \param[out] theParameter resulting parameter.
79    */
80   GEOMAPI_EXPORT const bool parameter(const std::shared_ptr<GeomAPI_Pnt> thePoint,
81                                       const double theTolerance,
82                                       double& theParameter) const;
83 };
84
85 //! Pointer on the object
86 typedef std::shared_ptr<GeomAPI_Circ> GeomCirclePtr;
87
88 #endif
89