Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:33

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