Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:19:59

0001 // Created on: 1992-09-28
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GC_MakeCircle2d_HeaderFile
0018 #define _GC_MakeCircle2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GC_Root.hxx>
0025 #include <Geom2d_Circle.hxx>
0026 
0027 class gp_Circ2d;
0028 class gp_Ax2d;
0029 class gp_Ax22d;
0030 class gp_Pnt2d;
0031 
0032 //! This class implements construction algorithms for circles in the plane.
0033 //! The result is a `Geom2d_Circle`.
0034 //! A `GC_MakeCircle2d` object provides a framework for:
0035 //! - defining the construction parameters;
0036 //! - running the construction algorithm;
0037 //! - querying the construction status and the resulting circle via `Value()`.
0038 //! @note A circle is parameterized in the range [0, 2*PI], and the X axis
0039 //!       of its local coordinate system defines the parameter origin.
0040 class GC_MakeCircle2d : public GC_Root
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Creates a circle from a non-persistent one from package gp.
0046   //! @param[in] theCircle source circle
0047   Standard_EXPORT GC_MakeCircle2d(const gp_Circ2d& theCircle);
0048 
0049   //! Creates a circle from an axis placement and radius.
0050   //! @param[in] theAxis axis placement
0051   //! @param[in] theRadius radius value
0052   //! @param[in] theSense orientation flag
0053   //! @note Construction fails with `gce_NegativeRadius` if `theRadius` is negative.
0054   Standard_EXPORT GC_MakeCircle2d(const gp_Ax2d& theAxis,
0055                                   const double   theRadius,
0056                                   const bool     theSense = true);
0057 
0058   //! Creates a circle from a local coordinate system and radius.
0059   //! @param[in] theAxis local coordinate system
0060   //! @param[in] theRadius radius value
0061   //! @note Construction fails with `gce_NegativeRadius` if `theRadius` is negative.
0062   Standard_EXPORT GC_MakeCircle2d(const gp_Ax22d& theAxis, const double theRadius);
0063 
0064   //! Creates a circle parallel to another one at signed distance.
0065   //! @param[in] theCircle source circle
0066   //! @param[in] theDist signed distance
0067   //! @note If `theDist` is positive, the resulting circle encloses `theCircle`.
0068   //! @note If `theDist` is negative, the resulting circle is enclosed by `theCircle`.
0069   //! @note Error status is provided by the underlying `gce_MakeCirc2d`.
0070   Standard_EXPORT GC_MakeCircle2d(const gp_Circ2d& theCircle, const double theDist);
0071 
0072   //! Creates a circle parallel to another one and passing through a point.
0073   //! @param[in] theCircle source circle
0074   //! @param[in] thePoint point on resulting circle
0075   //! @note Error status is provided by the underlying `gce_MakeCirc2d`.
0076   Standard_EXPORT GC_MakeCircle2d(const gp_Circ2d& theCircle, const gp_Pnt2d& thePoint);
0077 
0078   //! Creates a circle passing through three points.
0079   //! @param[in] theP1 first point
0080   //! @param[in] theP2 second point
0081   //! @param[in] theP3 third point
0082   //! @note Error status is provided by the underlying `gce_MakeCirc2d`.
0083   Standard_EXPORT GC_MakeCircle2d(const gp_Pnt2d& theP1,
0084                                   const gp_Pnt2d& theP2,
0085                                   const gp_Pnt2d& theP3);
0086 
0087   //! Creates a circle from center point and radius.
0088   //! @param[in] theCenter center point
0089   //! @param[in] theRadius radius value
0090   //! @param[in] theSense orientation flag
0091   //! @note Error status is provided by the underlying `gce_MakeCirc2d`.
0092   Standard_EXPORT GC_MakeCircle2d(const gp_Pnt2d& theCenter,
0093                                   const double    theRadius,
0094                                   const bool      theSense = true);
0095 
0096   //! Creates a circle from center point and one point on the circle.
0097   //! @param[in] theCenter center point
0098   //! @param[in] thePoint point on resulting circle
0099   //! @param[in] theSense orientation flag
0100   //! @note Error status is provided by the underlying `gce_MakeCirc2d`.
0101   Standard_EXPORT GC_MakeCircle2d(const gp_Pnt2d& theCenter,
0102                                   const gp_Pnt2d& thePoint,
0103                                   const bool      theSense = true);
0104 
0105   //! Returns the constructed circle.
0106   //! Exceptions StdFail_NotDone if no circle is constructed.
0107   //! @return resulting circle
0108   Standard_EXPORT const occ::handle<Geom2d_Circle>& Value() const;
0109 
0110   //! Conversion operator returning the constructed object.
0111   //! @return resulting circle
0112   operator const occ::handle<Geom2d_Circle>&() const { return Value(); }
0113 
0114 private:
0115   occ::handle<Geom2d_Circle> TheCircle;
0116 };
0117 
0118 #endif // _GC_MakeCircle2d_HeaderFile