Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-13 08:26:01

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 _GCE2d_MakeCircle_HeaderFile
0018 #define _GCE2d_MakeCircle_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GCE2d_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 the following algorithms used
0033 //! to create Circle from Geom2d.
0034 //!
0035 //! * Create a Circle parallel to another and passing
0036 //! though a point.
0037 //! * Create a Circle parallel to another at the distance
0038 //! Dist.
0039 //! * Create a Circle passing through 3 points.
0040 //! * Create a Circle with its center and the normal of its
0041 //! plane and its radius.
0042 //! * Create a Circle with its axis and radius.
0043 class GCE2d_MakeCircle : public GCE2d_Root
0044 {
0045 public:
0046   DEFINE_STANDARD_ALLOC
0047 
0048   //! creates a circle from a non persistent one.
0049   Standard_EXPORT GCE2d_MakeCircle(const gp_Circ2d& C);
0050 
0051   //! A is the "XAxis" of the circle which defines the origin
0052   //! of parametrization.
0053   //! It is not forbidden to create a circle with Radius = 0.0
0054   //! The status is "NegativeRadius" if Radius < 0.
0055   Standard_EXPORT GCE2d_MakeCircle(const gp_Ax2d&         A,
0056                                    const Standard_Real    Radius,
0057                                    const Standard_Boolean Sense = Standard_True);
0058 
0059   //! A is the local coordinate system of the circle which defines
0060   //! the origin of parametrization.
0061   //! It is not forbidden to create a circle with Radius = 0.0
0062   //! The status is "NegativeRadius" if Radius < 0.
0063   Standard_EXPORT GCE2d_MakeCircle(const gp_Ax22d& A, const Standard_Real Radius);
0064 
0065   //! Make a Circle from Geom2d <TheCirc> parallel to another
0066   //! Circ <Circ> with a distance <Dist>.
0067   //! If Dist is greater than zero the result is enclosing
0068   //! the circle <Circ>, else the result is enclosed by the
0069   //! circle <Circ>.
0070   Standard_EXPORT GCE2d_MakeCircle(const gp_Circ2d& Circ, const Standard_Real Dist);
0071 
0072   //! Make a Circle from Geom2d <TheCirc> parallel to another
0073   //! Circ <Circ> and passing through a Pnt <Point>.
0074   Standard_EXPORT GCE2d_MakeCircle(const gp_Circ2d& Circ, const gp_Pnt2d& Point);
0075 
0076   //! Make a Circ from gp <TheCirc> passing through 3
0077   //! Pnt2d <P1>,<P2>,<P3>.
0078   Standard_EXPORT GCE2d_MakeCircle(const gp_Pnt2d& P1, const gp_Pnt2d& P2, const gp_Pnt2d& P3);
0079 
0080   //! Make a Circ from geom2d <TheCirc> by its center an radius.
0081   Standard_EXPORT GCE2d_MakeCircle(const gp_Pnt2d&        P,
0082                                    const Standard_Real    Radius,
0083                                    const Standard_Boolean Sense = Standard_True);
0084 
0085   //! Makes a Circle from geom2d <TheCirc> with its center
0086   //! <Center> and a point giving the radius.
0087   //! If Sense is true the local coordinate system of
0088   //! the solution is direct and non direct in the other case.
0089   //! Warning
0090   //! The MakeCircle class does not prevent the
0091   //! construction of a circle with a null radius.
0092   //! If an error occurs (that is, when IsDone returns
0093   //! false), the Status function returns:
0094   //! -   gce_NegativeRadius if Radius is less than 0.0, or
0095   //! -   gce_IntersectionError if points P1, P2 and P3
0096   //! are collinear and the three are not coincident.
0097   Standard_EXPORT GCE2d_MakeCircle(const gp_Pnt2d&        Center,
0098                                    const gp_Pnt2d&        Point,
0099                                    const Standard_Boolean Sense = Standard_True);
0100 
0101   //! Returns the constructed circle.
0102   //! Exceptions StdFail_NotDone if no circle is constructed.
0103   Standard_EXPORT const Handle(Geom2d_Circle)& Value() const;
0104 
0105   operator const Handle(Geom2d_Circle) & () const { return Value(); }
0106 
0107 private:
0108   Handle(Geom2d_Circle) TheCircle;
0109 };
0110 
0111 #endif // _GCE2d_MakeCircle_HeaderFile