1 // Created on: 1993-03-24
2 // Created by: Philippe DAUTRY
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom2d_Circle_HeaderFile
18 #define _Geom2d_Circle_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Geom2d_Conic.hxx>
24 #include <Standard_Integer.hxx>
31 class Geom2d_Geometry;
35 DEFINE_STANDARD_HANDLE(Geom2d_Circle, Geom2d_Conic)
37 //! Describes a circle in the plane (2D space).
38 //! A circle is defined by its radius and, as with any conic
39 //! curve, is positioned in the plane with a coordinate
40 //! system (gp_Ax22d object) where the origin is the
41 //! center of the circle.
42 //! The coordinate system is the local coordinate
43 //! system of the circle.
44 //! The orientation (direct or indirect) of the local
45 //! coordinate system gives an explicit orientation to the
46 //! circle, determining the direction in which the
47 //! parameter increases along the circle.
48 //! The Geom2d_Circle circle is parameterized by an angle:
49 //! P(U) = O + R*Cos(U)*XDir + R*Sin(U)*YDir
51 //! - P is the point of parameter U,
52 //! - O, XDir and YDir are respectively the origin, "X
53 //! Direction" and "Y Direction" of its local coordinate system,
54 //! - R is the radius of the circle.
55 //! The "X Axis" of the local coordinate system therefore
56 //! defines the origin of the parameter of the circle. The
57 //! parameter is the angle with this "X Direction".
58 //! A circle is a closed and periodic curve. The period is
59 //! 2.*Pi and the parameter range is [ 0,2.*Pi [.
61 //! GCE2d_MakeCircle which provides functions for
62 //! more complex circle constructions
63 //! gp_Ax22d and gp_Circ2d for an equivalent, non-parameterized data structure.
64 class Geom2d_Circle : public Geom2d_Conic
70 //! Constructs a circle by conversion of the gp_Circ2d circle C.
71 Standard_EXPORT Geom2d_Circle(const gp_Circ2d& C);
73 //! Constructs a circle of radius Radius, whose center is the origin of axis
74 //! A; A is the "X Axis" of the local coordinate system
75 //! of the circle; this coordinate system is direct if
76 //! Sense is true (default value) or indirect if Sense is false.
77 //! Note: It is possible to create a circle where Radius is equal to 0.0.
78 //! Exceptions Standard_ConstructionError if Radius is negative.
79 Standard_EXPORT Geom2d_Circle(const gp_Ax2d& A, const Standard_Real Radius, const Standard_Boolean Sense = Standard_True);
81 //! Constructs a circle
82 //! of radius Radius, where the coordinate system A
83 //! locates the circle and defines its orientation in the plane such that:
84 //! - the center of the circle is the origin of A,
85 //! - the orientation (direct or indirect) of A gives the
86 //! orientation of the circle.
87 Standard_EXPORT Geom2d_Circle(const gp_Ax22d& A, const Standard_Real Radius);
90 //! Converts the gp_Circ2d circle C into this circle.
91 Standard_EXPORT void SetCirc2d (const gp_Circ2d& C);
93 Standard_EXPORT void SetRadius (const Standard_Real R);
96 //! Returns the non persistent circle from gp with the same
97 //! geometric properties as <me>.
98 Standard_EXPORT gp_Circ2d Circ2d() const;
100 //! Returns the radius of this circle.
101 Standard_EXPORT Standard_Real Radius() const;
103 //! Computes the parameter on the reversed circle for
104 //! the point of parameter U on this circle.
105 //! For a circle, the returned value is: 2.*Pi - U.
106 Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
108 //! Returns 0., which is the eccentricity of any circle.
109 Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE;
112 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
115 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
118 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
120 //! returns True. The period of a circle is 2.*Pi.
121 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
123 //! Returns in P the point of parameter U.
124 //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir
125 //! where C is the center of the circle , XDir the XDirection and
126 //! YDir the YDirection of the circle's local coordinate system.
127 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE;
130 //! Returns the point P of parameter U and the first derivative V1.
131 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1) const Standard_OVERRIDE;
134 //! Returns the point P of parameter U, the first and second
135 //! derivatives V1 and V2.
136 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE;
139 //! Returns the point P of parameter u, the first second and third
140 //! derivatives V1 V2 and V3.
141 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE;
143 //! For the point of parameter U of this circle, computes
144 //! the vector corresponding to the Nth derivative.
145 //! Exceptions: Standard_RangeError if N is less than 1.
146 Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
148 //! Applies the transformation T to this circle.
149 Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE;
151 //! Creates a new object which is a copy of this circle.
152 Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE;
154 //! Dumps the content of me into the stream
155 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
160 DEFINE_STANDARD_RTTIEXT(Geom2d_Circle,Geom2d_Conic)
170 Standard_Real radius;
181 #endif // _Geom2d_Circle_HeaderFile