Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:20:14

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