1 // Copyright (C) 2014-2019 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 email : webmaster.salome@opencascade.com
20 #ifndef GeomAPI_Circ2d_H_
21 #define GeomAPI_Circ2d_H_
23 #include <GeomAPI_Interface.h>
31 /**\class GeomAPI_Circ2d
36 class GeomAPI_Circ2d : public GeomAPI_Interface
39 /// Creation of circle defined by center point and circle radius
41 GeomAPI_Circ2d(const double theCenterX, const double theCenterY, const double theRadius);
43 /// Creation of circle defined by center point and circle radius
45 GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
46 const std::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
48 /// Creation of circle defined by center point, direction and circle radius
50 GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
51 const std::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
53 /// Return center of the circle
55 const std::shared_ptr<GeomAPI_Pnt2d> center() const;
57 /// Return radius of the circle
59 double radius() const;
61 /// Project point on line
63 const std::shared_ptr<GeomAPI_Pnt2d> project(
64 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
66 /** \brief Computes the parameter of a given point on a circle. The point must be
67 * located either on the circle itself or relatively to the latter
68 * at a distance less than the tolerance value. Return FALSE if the point
69 * is beyond the tolerance limit or if computation fails.
70 * Max Tolerance value is currently limited to 1.e-4
71 * \param[in] thePoint point of origin.
72 * \param[in] theTolerance tolerance of computation.
73 * \param[out] theParameter resulting parameter.
75 GEOMAPI_EXPORT const bool parameter(const std::shared_ptr<GeomAPI_Pnt2d> thePoint,
76 const double theTolerance,
77 double& theParameter) const;
79 /** \brief Returns in thePoint the point of parameter theU.
80 * P = C + R * Cos (U) * XDir + R * Sin (U) * YDir where C is the center of the circle,
81 * XDir the XDirection and YDir the YDirection of the circle's local coordinate system.
82 * \param[in] theU parameter.
83 * \param[out] thePoint resulting point.
85 GEOMAPI_EXPORT void D0(const double theU, std::shared_ptr<GeomAPI_Pnt2d>& thePoint);