1 // Created on: 1993-03-10
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 _Geom_Circle_HeaderFile
18 #define _Geom_Circle_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Real.hxx>
24 #include <Geom_Conic.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Integer.hxx>
27 class Standard_ConstructionError;
28 class Standard_RangeError;
38 DEFINE_STANDARD_HANDLE(Geom_Circle, Geom_Conic)
40 //! Describes a circle in 3D space.
41 //! A circle is defined by its radius and, as with any conic
42 //! curve, is positioned in space with a right-handed
43 //! coordinate system (gp_Ax2 object) where:
44 //! - the origin is the center of the circle, and
45 //! - the origin, "X Direction" and "Y Direction" define the
46 //! plane of the circle.
47 //! This coordinate system is the local coordinate
48 //! system of the circle.
49 //! The "main Direction" of this coordinate system is the
50 //! vector normal to the plane of the circle. The axis, of
51 //! which the origin and unit vector are respectively the
52 //! origin and "main Direction" of the local coordinate
53 //! system, is termed the "Axis" or "main Axis" of the circle.
54 //! The "main Direction" of the local coordinate system
55 //! gives an explicit orientation to the circle (definition of
56 //! the trigonometric sense), determining the direction in
57 //! which the parameter increases along the circle.
58 //! The Geom_Circle circle is parameterized by an angle:
59 //! P(U) = O + R*Cos(U)*XDir + R*Sin(U)*YDir, where:
60 //! - P is the point of parameter U,
61 //! - O, XDir and YDir are respectively the origin, "X
62 //! Direction" and "Y Direction" of its local coordinate system,
63 //! - R is the radius of the circle.
64 //! The "X Axis" of the local coordinate system therefore
65 //! defines the origin of the parameter of the circle. The
66 //! parameter is the angle with this "X Direction".
67 //! A circle is a closed and periodic curve. The period is
68 //! 2.*Pi and the parameter range is [ 0, 2.*Pi [.
69 class Geom_Circle : public Geom_Conic
75 //! Constructs a circle by conversion of the gp_Circ circle C.
76 Standard_EXPORT Geom_Circle(const gp_Circ& C);
78 //! Constructs a circle of radius Radius, where A2 locates the circle and
79 //! defines its orientation in 3D space such that:
80 //! - the center of the circle is the origin of A2,
81 //! - the origin, "X Direction" and "Y Direction" of A2
82 //! define the plane of the circle,
83 //! - A2 is the local coordinate system of the circle.
84 //! Note: It is possible to create a circle where Radius is equal to 0.0.
85 //! raised if Radius < 0.
86 Standard_EXPORT Geom_Circle(const gp_Ax2& A2, const Standard_Real Radius);
89 //! Set <me> so that <me> has the same geometric properties as C.
90 Standard_EXPORT void SetCirc (const gp_Circ& C);
92 //! Assigns the value R to the radius of this circle.
93 //! Note: it is possible to have a circle with a radius equal to 0.0.
94 //! Exceptions - Standard_ConstructionError if R is negative.
95 Standard_EXPORT void SetRadius (const Standard_Real R);
98 //! returns the non transient circle from gp with the same
99 //! geometric properties as <me>.
100 Standard_EXPORT gp_Circ Circ() const;
102 //! Returns the radius of this circle.
103 Standard_EXPORT Standard_Real Radius() const;
105 //! Computes the parameter on the reversed circle for
106 //! the point of parameter U on this circle.
107 //! For a circle, the returned value is: 2.*Pi - U.
108 Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
110 //! Returns the eccentricity e = 0 for a circle.
111 Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE;
113 //! Returns the value of the first parameter of this
114 //! circle. This is 0.0, which gives the start point of this circle, or
115 //! The start point and end point of a circle are coincident.
116 Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE;
118 //! Returns the value of the last parameter of this
119 //! circle. This is 2.*Pi, which gives the end point of this circle.
120 //! The start point and end point of a circle are coincident.
121 Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE;
124 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
127 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
129 //! Returns in P the point of parameter U.
130 //! P = C + R * Cos (U) * XDir + R * Sin (U) * YDir
131 //! where C is the center of the circle , XDir the XDirection and
132 //! YDir the YDirection of the circle's local coordinate system.
133 Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt& P) const Standard_OVERRIDE;
136 //! Returns the point P of parameter U and the first derivative V1.
137 Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const Standard_OVERRIDE;
140 //! Returns the point P of parameter U, the first and second
141 //! derivatives V1 and V2.
142 Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const Standard_OVERRIDE;
145 //! Returns the point P of parameter u, the first second and third
146 //! derivatives V1 V2 and V3.
147 Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const Standard_OVERRIDE;
150 //! The returned vector gives the value of the derivative for the
151 //! order of derivation N.
153 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
155 //! Applies the transformation T to this circle.
156 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
158 //! Creates a new object which is a copy of this circle.
159 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
161 //! Dumps the content of me into the stream
162 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
167 DEFINE_STANDARD_RTTIEXT(Geom_Circle,Geom_Conic)
177 Standard_Real radius;
188 #endif // _Geom_Circle_HeaderFile