Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:15:35

0001 // Created on: 1993-03-10
0002 // Created by: JCV
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 _Geom_Circle_HeaderFile
0018 #define _Geom_Circle_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Geom_Conic.hxx>
0024 class gp_Circ;
0025 class gp_Ax2;
0026 class gp_Trsf;
0027 class Geom_Geometry;
0028 
0029 //! Describes a circle in 3D space.
0030 //! A circle is defined by its radius and, as with any conic
0031 //! curve, is positioned in space with a right-handed
0032 //! coordinate system (gp_Ax2 object) where:
0033 //! - the origin is the center of the circle, and
0034 //! - the origin, "X Direction" and "Y Direction" define the
0035 //! plane of the circle.
0036 //! This coordinate system is the local coordinate
0037 //! system of the circle.
0038 //! The "main Direction" of this coordinate system is the
0039 //! vector normal to the plane of the circle. The axis, of
0040 //! which the origin and unit vector are respectively the
0041 //! origin and "main Direction" of the local coordinate
0042 //! system, is termed the "Axis" or "main Axis" of the circle.
0043 //! The "main Direction" of the local coordinate system
0044 //! gives an explicit orientation to the circle (definition of
0045 //! the trigonometric sense), determining the direction in
0046 //! which the parameter increases along the circle.
0047 //! The Geom_Circle circle is parameterized by an angle:
0048 //! P(U) = O + R*std::cos(U)*XDir + R*Sin(U)*YDir, where:
0049 //! - P is the point of parameter U,
0050 //! - O, XDir and YDir are respectively the origin, "X
0051 //! Direction" and "Y Direction" of its local coordinate system,
0052 //! - R is the radius of the circle.
0053 //! The "X Axis" of the local coordinate system therefore
0054 //! defines the origin of the parameter of the circle. The
0055 //! parameter is the angle with this "X Direction".
0056 //! A circle is a closed and periodic curve. The period is
0057 //! 2.*Pi and the parameter range is [ 0, 2.*Pi [.
0058 class Geom_Circle : public Geom_Conic
0059 {
0060 
0061 public:
0062   //! Constructs a circle by conversion of the gp_Circ circle C.
0063   Standard_EXPORT Geom_Circle(const gp_Circ& C);
0064 
0065   //! Constructs a circle of radius Radius, where A2 locates the circle and
0066   //! defines its orientation in 3D space such that:
0067   //! - the center of the circle is the origin of A2,
0068   //! - the origin, "X Direction" and "Y Direction" of A2
0069   //! define the plane of the circle,
0070   //! - A2 is the local coordinate system of the circle.
0071   //! Note: It is possible to create a circle where Radius is equal to 0.0.
0072   //! raised if Radius < 0.
0073   Standard_EXPORT Geom_Circle(const gp_Ax2& A2, const double Radius);
0074 
0075   //! Set <me> so that <me> has the same geometric properties as C.
0076   Standard_EXPORT void SetCirc(const gp_Circ& C);
0077 
0078   //! Assigns the value R to the radius of this circle.
0079   //! Note: it is possible to have a circle with a radius equal to 0.0.
0080   //! Exceptions - Standard_ConstructionError if R is negative.
0081   Standard_EXPORT void SetRadius(const double R);
0082 
0083   //! returns the non transient circle from gp with the same
0084   //! geometric properties as <me>.
0085   Standard_EXPORT gp_Circ Circ() const;
0086 
0087   //! Returns the radius of this circle.
0088   Standard_EXPORT double Radius() const;
0089 
0090   //! Computes the parameter on the reversed circle for
0091   //! the point of parameter U on this circle.
0092   //! For a circle, the returned value is: 2.*Pi - U.
0093   Standard_EXPORT double ReversedParameter(const double U) const final;
0094 
0095   //! Returns the eccentricity e = 0 for a circle.
0096   Standard_EXPORT double Eccentricity() const final;
0097 
0098   //! Returns the value of the first parameter of this
0099   //! circle. This is 0.0, which gives the start point of this circle, or
0100   //! The start point and end point of a circle are coincident.
0101   Standard_EXPORT double FirstParameter() const final;
0102 
0103   //! Returns the value of the last parameter of this
0104   //! circle. This is 2.*Pi, which gives the end point of this circle.
0105   //! The start point and end point of a circle are coincident.
0106   Standard_EXPORT double LastParameter() const final;
0107 
0108   //! returns True.
0109   Standard_EXPORT bool IsClosed() const final;
0110 
0111   //! returns True.
0112   Standard_EXPORT bool IsPeriodic() const final;
0113 
0114   //! Returns the point of parameter U.
0115   //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir
0116   //! where C is the center of the circle , XDir the XDirection and
0117   //! YDir the YDirection of the circle's local coordinate system.
0118   Standard_EXPORT gp_Pnt EvalD0(const double U) const final;
0119 
0120   //! Returns the point of parameter U and the first derivative.
0121   Standard_EXPORT Geom_Curve::ResD1 EvalD1(const double U) const final;
0122 
0123   //! Returns the point of parameter U, the first and second
0124   //! derivatives.
0125   Standard_EXPORT Geom_Curve::ResD2 EvalD2(const double U) const final;
0126 
0127   //! Returns the point of parameter U, the first, second and third
0128   //! derivatives.
0129   Standard_EXPORT Geom_Curve::ResD3 EvalD3(const double U) const final;
0130 
0131   //! Returns the vector corresponding to the derivative for the
0132   //! order of derivation N.
0133   //! Raised if N < 1.
0134   Standard_EXPORT gp_Vec EvalDN(const double U, const int N) const final;
0135 
0136   //! Applies the transformation T to this circle.
0137   Standard_EXPORT void Transform(const gp_Trsf& T) final;
0138 
0139   //! Creates a new object which is a copy of this circle.
0140   Standard_EXPORT occ::handle<Geom_Geometry> Copy() const final;
0141 
0142   //! Dumps the content of me into the stream
0143   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final;
0144 
0145   DEFINE_STANDARD_RTTIEXT(Geom_Circle, Geom_Conic)
0146 
0147 private:
0148   double radius;
0149 };
0150 
0151 #endif // _Geom_Circle_HeaderFile