CommitLineData
42cf5bc1 1// Created on: 1993-03-10
2// Created by: JCV
3// Copyright (c) 1993-1999 Matra Datavision
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Standard_Real.hxx>
24#include <Geom_Conic.hxx>
25#include <Standard_Boolean.hxx>
26#include <Standard_Integer.hxx>
27class Standard_ConstructionError;
28class Standard_RangeError;
29class gp_Circ;
30class gp_Ax2;
31class gp_Pnt;
32class gp_Vec;
33class gp_Trsf;
34class Geom_Geometry;
35
36
37class Geom_Circle;
38DEFINE_STANDARD_HANDLE(Geom_Circle, Geom_Conic)
39
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 [.
69class Geom_Circle : public Geom_Conic
70{
71
72public:
73
74
75 //! Constructs a circle by conversion of the gp_Circ circle C.
76 Standard_EXPORT Geom_Circle(const gp_Circ& C);
77
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);
87
88
89 //! Set <me> so that <me> has the same geometric properties as C.
90 Standard_EXPORT void SetCirc (const gp_Circ& C);
91
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);
96
97
98 //! returns the non transient circle from gp with the same
99 //! geometric properties as <me>.
100 Standard_EXPORT gp_Circ Circ() const;
101
102 //! Returns the radius of this circle.
104
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;
109
110 //! Returns the eccentricity e = 0 for a circle.
111 Standard_EXPORT Standard_Real Eccentricity() const Standard_OVERRIDE;
112
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;
117
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;
122
123 //! returns True.
124 Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE;
125
126 //! returns True.
127 Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE;
128
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;
134
135
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;
138
139
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;
143
144
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;
148
149
150 //! The returned vector gives the value of the derivative for the
151 //! order of derivation N.
152 //! Raised if N < 1.
153 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE;
154
155 //! Applies the transformation T to this circle.
156 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
157
158 //! Creates a new object which is a copy of this circle.
159 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
160
161
162
163
92efcf78 164 DEFINE_STANDARD_RTTIEXT(Geom_Circle,Geom_Conic)
42cf5bc1 165
166protected:
167
168
169
170
171private:
172
173