1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef GeomAPI_Circ_H_
22 #define GeomAPI_Circ_H_
24 #include <GeomAPI_Interface.h>
25 #include <GeomAPI_Curve.h>
32 /**\class GeomAPI_Circ
37 class GeomAPI_Circ : public GeomAPI_Interface
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.
48 GEOMAPI_EXPORT GeomAPI_Circ(const std::shared_ptr<GeomAPI_Ax2> theAx2,
49 const double theRadius);
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);
55 /// Creation of circle defined by a curve
56 GEOMAPI_EXPORT GeomAPI_Circ(const GeomCurvePtr& theCurve);
58 /// Return center of the circle
59 GEOMAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt> center() const;
61 /// Return radius of the circle
62 GEOMAPI_EXPORT double radius() const;
64 /// Return orthogonal direction to the circle's plane
65 GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> normal() const;
67 /// Project point on circle
68 GEOMAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt> project(
69 const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
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.
80 GEOMAPI_EXPORT const bool parameter(const std::shared_ptr<GeomAPI_Pnt> thePoint,
81 const double theTolerance,
82 double& theParameter) const;
85 //! Pointer on the object
86 typedef std::shared_ptr<GeomAPI_Circ> GeomCirclePtr;