Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-20 08:17:50

0001 // Created on: 1993-03-24
0002 // Created by: Philippe DAUTRY
0003 // Copyright (c) 1993-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 _Geom2d_Circle_HeaderFile
0018 #define _Geom2d_Circle_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom2d_Conic.hxx>
0024 #include <Standard_Integer.hxx>
0025 class gp_Circ2d;
0026 class gp_Ax2d;
0027 class gp_Ax22d;
0028 class gp_Pnt2d;
0029 class gp_Vec2d;
0030 class gp_Trsf2d;
0031 class Geom2d_Geometry;
0032 
0033 class Geom2d_Circle;
0034 DEFINE_STANDARD_HANDLE(Geom2d_Circle, Geom2d_Conic)
0035 
0036 //! Describes a circle in the plane (2D space).
0037 //! A circle is defined by its radius and, as with any conic
0038 //! curve, is positioned in the plane with a coordinate
0039 //! system (gp_Ax22d object) where the origin is the
0040 //! center of the circle.
0041 //! The coordinate system is the local coordinate
0042 //! system of the circle.
0043 //! The orientation (direct or indirect) of the local
0044 //! coordinate system gives an explicit orientation to the
0045 //! circle, determining the direction in which the
0046 //! parameter increases along the circle.
0047 //! The Geom2d_Circle circle is parameterized by an angle:
0048 //! P(U) = O + R*Cos(U)*XDir + R*Sin(U)*YDir
0049 //! where:
0050 //! - P is the point of parameter U,
0051 //! - O, XDir and YDir are respectively the origin, "X
0052 //! Direction" and "Y Direction" of its local coordinate system,
0053 //! - R is the radius of the circle.
0054 //! The "X Axis" of the local coordinate system therefore
0055 //! defines the origin of the parameter of the circle. The
0056 //! parameter is the angle with this "X Direction".
0057 //! A circle is a closed and periodic curve. The period is
0058 //! 2.*Pi and the parameter range is [ 0,2.*Pi [.
0059 //! See Also
0060 //! GCE2d_MakeCircle which provides functions for
0061 //! more complex circle constructions
0062 //! gp_Ax22d and  gp_Circ2d for an equivalent, non-parameterized data structure.
0063 class Geom2d_Circle : public Geom2d_Conic
0064 {
0065 
0066 public:
0067   //! Constructs a circle by conversion of the gp_Circ2d circle C.
0068   Standard_EXPORT Geom2d_Circle(const gp_Circ2d& C);
0069 
0070   //! Constructs a circle of radius Radius, whose center is the origin of axis
0071   //! A; A is the "X Axis" of the local coordinate system
0072   //! of the circle; this coordinate system is direct if
0073   //! Sense is true (default value) or indirect if Sense is false.
0074   //! Note: It is possible to create a circle where Radius is equal to 0.0.
0075   //! Exceptions Standard_ConstructionError if Radius is negative.
0076   Standard_EXPORT Geom2d_Circle(const gp_Ax2d&         A,
0077                                 const Standard_Real    Radius,
0078                                 const Standard_Boolean Sense = Standard_True);
0079 
0080   //! Constructs a circle
0081   //! of radius Radius, where the coordinate system A
0082   //! locates the circle and defines its orientation in the plane such that:
0083   //! - the center of the circle is the origin of A,
0084   //! - the orientation (direct or indirect) of A gives the
0085   //! orientation of the circle.
0086   Standard_EXPORT Geom2d_Circle(const gp_Ax22d& A, const Standard_Real Radius);
0087 
0088   //! Converts the gp_Circ2d circle C into this circle.
0089   Standard_EXPORT void SetCirc2d(const gp_Circ2d& C);
0090 
0091   Standard_EXPORT void SetRadius(const Standard_Real R);
0092 
0093   //! Returns the non persistent circle from gp with the same
0094   //! geometric properties as <me>.
0095   Standard_EXPORT gp_Circ2d Circ2d() const;
0096 
0097   //! Returns the radius of this circle.
0098   Standard_EXPORT Standard_Real Radius() const;
0099 
0100   //! Computes the parameter on the reversed circle for
0101   //! the point of parameter U on this circle.
0102   //! For a circle, the returned value is: 2.*Pi - U.
0103   Standard_EXPORT Standard_Real ReversedParameter(const Standard_Real U) const Standard_OVERRIDE;
0104 
0105   //! Returns 0., which is the eccentricity of any circle.
0106   Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE;
0107 
0108   //! Returns 0.0
0109   Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
0110 
0111   //! Returns 2*PI.
0112   Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
0113 
0114   //! returns True.
0115   Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
0116 
0117   //! returns True. The period of a circle is 2.*Pi.
0118   Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
0119 
0120   //! Returns in P the point of parameter U.
0121   //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir
0122   //! where C is the center of the circle , XDir the XDirection and
0123   //! YDir the YDirection of the circle's local coordinate system.
0124   Standard_EXPORT void D0(const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE;
0125 
0126   //! Returns the point P of parameter U and the first derivative V1.
0127   Standard_EXPORT void D1(const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE;
0128 
0129   //! Returns the point P of parameter U, the first and second
0130   //! derivatives V1 and V2.
0131   Standard_EXPORT void D2(const Standard_Real U,
0132                           gp_Pnt2d&           P,
0133                           gp_Vec2d&           V1,
0134                           gp_Vec2d&           V2) const Standard_OVERRIDE;
0135 
0136   //! Returns the point P of parameter u, the first second and third
0137   //! derivatives V1 V2 and V3.
0138   Standard_EXPORT void D3(const Standard_Real U,
0139                           gp_Pnt2d&           P,
0140                           gp_Vec2d&           V1,
0141                           gp_Vec2d&           V2,
0142                           gp_Vec2d&           V3) const Standard_OVERRIDE;
0143 
0144   //! For the point of parameter U of this circle, computes
0145   //! the vector corresponding to the Nth derivative.
0146   //! Exceptions: Standard_RangeError if N is less than 1.
0147   Standard_EXPORT gp_Vec2d DN(const Standard_Real    U,
0148                               const Standard_Integer N) const Standard_OVERRIDE;
0149 
0150   //! Applies the transformation T to this circle.
0151   Standard_EXPORT void Transform(const gp_Trsf2d& T) Standard_OVERRIDE;
0152 
0153   //! Creates a new object which is a copy of this circle.
0154   Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
0155 
0156   //! Dumps the content of me into the stream
0157   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0158                                         Standard_Integer  theDepth = -1) const Standard_OVERRIDE;
0159 
0160   DEFINE_STANDARD_RTTIEXT(Geom2d_Circle, Geom2d_Conic)
0161 
0162 protected:
0163 private:
0164   Standard_Real radius;
0165 };
0166 
0167 #endif // _Geom2d_Circle_HeaderFile