0031044: Coding - Standard_NODISCARD should be placed before Standard_EXPORT
[occt.git] / src / Geom / Geom_Curve.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-03-10
2// Created by: JCV
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
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
17#ifndef _Geom_Curve_HeaderFile
18#define _Geom_Curve_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Geom_Geometry.hxx>
24#include <Standard_Real.hxx>
25#include <Standard_Boolean.hxx>
26#include <GeomAbs_Shape.hxx>
27#include <Standard_Integer.hxx>
28class Standard_RangeError;
29class Standard_NoSuchObject;
30class Geom_UndefinedDerivative;
31class Geom_UndefinedValue;
32class gp_Trsf;
33class gp_Pnt;
34class gp_Vec;
35
36
37class Geom_Curve;
38DEFINE_STANDARD_HANDLE(Geom_Curve, Geom_Geometry)
39
40//! The abstract class Curve describes the common
41//! behavior of curves in 3D space. The Geom package
42//! provides numerous concrete classes of derived
43//! curves, including lines, circles, conics, Bezier or
44//! BSpline curves, etc.
45//! The main characteristic of these curves is that they
46//! are parameterized. The Geom_Curve class shows:
47//! - how to work with the parametric equation of a curve
48//! in order to calculate the point of parameter u,
49//! together with the vector tangent and the derivative
50//! vectors of order 2, 3,..., N at this point;
51//! - how to obtain general information about the curve
52//! (for example, level of continuity, closed
53//! characteristics, periodicity, bounds of the parameter field);
54//! - how the parameter changes when a geometric
55//! transformation is applied to the curve or when the
56//! orientation of the curve is inverted.
57//! All curves must have a geometric continuity: a curve is
58//! at least "C0". Generally, this property is checked at
59//! the time of construction or when the curve is edited.
60//! Where this is not the case, the documentation states so explicitly.
61//! Warning
62//! The Geom package does not prevent the
63//! construction of curves with null length or curves which
64//! self-intersect.
65class Geom_Curve : public Geom_Geometry
66{
67
68public:
69
70
71
72 //! Changes the direction of parametrization of <me>.
73 //! The "FirstParameter" and the "LastParameter" are not changed
74 //! but the orientation of the curve is modified. If the curve
75 //! is bounded the StartPoint of the initial curve becomes the
76 //! EndPoint of the reversed curve and the EndPoint of the initial
77 //! curve becomes the StartPoint of the reversed curve.
78 Standard_EXPORT virtual void Reverse() = 0;
79
80 //! Returns the parameter on the reversed curve for
81 //! the point of parameter U on <me>.
82 //!
83 //! me->Reversed()->Value(me->ReversedParameter(U))
84 //!
85 //! is the same point as
86 //!
87 //! me->Value(U)
88 Standard_EXPORT virtual Standard_Real ReversedParameter (const Standard_Real U) const = 0;
89
90 //! Returns the parameter on the transformed curve for
91 //! the transform of the point of parameter U on <me>.
92 //!
93 //! me->Transformed(T)->Value(me->TransformedParameter(U,T))
94 //!
95 //! is the same point as
96 //!
97 //! me->Value(U).Transformed(T)
98 //!
99 //! This methods returns <U>
100 //!
101 //! It can be redefined. For example on the Line.
102 Standard_EXPORT virtual Standard_Real TransformedParameter (const Standard_Real U, const gp_Trsf& T) const;
103
104 //! Returns a coefficient to compute the parameter on
105 //! the transformed curve for the transform of the
106 //! point on <me>.
107 //!
108 //! Transformed(T)->Value(U * ParametricTransformation(T))
109 //!
110 //! is the same point as
111 //!
112 //! Value(U).Transformed(T)
113 //!
114 //! This methods returns 1.
115 //!
116 //! It can be redefined. For example on the Line.
117 Standard_EXPORT virtual Standard_Real ParametricTransformation (const gp_Trsf& T) const;
118
119 //! Returns a copy of <me> reversed.
6ed44b1c 120 Standard_NODISCARD Standard_EXPORT Handle(Geom_Curve) Reversed() const;
42cf5bc1 121
122 //! Returns the value of the first parameter.
123 //! Warnings :
124 //! It can be RealFirst from package Standard
125 //! if the curve is infinite
126 Standard_EXPORT virtual Standard_Real FirstParameter() const = 0;
127
128 //! Returns the value of the last parameter.
129 //! Warnings :
130 //! It can be RealLast from package Standard
131 //! if the curve is infinite
132 Standard_EXPORT virtual Standard_Real LastParameter() const = 0;
133
134 //! Returns true if the curve is closed.
135 //! Some curves such as circle are always closed, others such as line
136 //! are never closed (by definition).
137 //! Some Curves such as OffsetCurve can be closed or not. These curves
138 //! are considered as closed if the distance between the first point
139 //! and the last point of the curve is lower or equal to the Resolution
140 //! from package gp wich is a fixed criterion independant of the
141 //! application.
142 Standard_EXPORT virtual Standard_Boolean IsClosed() const = 0;
143
144 //! Is the parametrization of the curve periodic ?
145 //! It is possible only if the curve is closed and if the
146 //! following relation is satisfied :
147 //! for each parametric value U the distance between the point
148 //! P(u) and the point P (u + T) is lower or equal to Resolution
149 //! from package gp, T is the period and must be a constant.
150 //! There are three possibilities :
151 //! . the curve is never periodic by definition (SegmentLine)
152 //! . the curve is always periodic by definition (Circle)
153 //! . the curve can be defined as periodic (BSpline). In this case
154 //! a function SetPeriodic allows you to give the shape of the
155 //! curve. The general rule for this case is : if a curve can be
156 //! periodic or not the default periodicity set is non periodic
157 //! and you have to turn (explicitly) the curve into a periodic
158 //! curve if you want the curve to be periodic.
159 Standard_EXPORT virtual Standard_Boolean IsPeriodic() const = 0;
160
161 //! Returns the period of this curve.
162 //! Exceptions Standard_NoSuchObject if this curve is not periodic.
163 Standard_EXPORT virtual Standard_Real Period() const;
164
165 //! It is the global continuity of the curve
166 //! C0 : only geometric continuity,
167 //! C1 : continuity of the first derivative all along the Curve,
168 //! C2 : continuity of the second derivative all along the Curve,
169 //! C3 : continuity of the third derivative all along the Curve,
170 //! G1 : tangency continuity all along the Curve,
171 //! G2 : curvature continuity all along the Curve,
172 //! CN : the order of continuity is infinite.
173 Standard_EXPORT virtual GeomAbs_Shape Continuity() const = 0;
174
175 //! Returns true if the degree of continuity of this curve is at least N.
176 //! Exceptions - Standard_RangeError if N is less than 0.
177 Standard_EXPORT virtual Standard_Boolean IsCN (const Standard_Integer N) const = 0;
178
179 //! Returns in P the point of parameter U.
180 //! If the curve is periodic then the returned point is P(U) with
181 //! U = Ustart + (U - Uend) where Ustart and Uend are the
182 //! parametric bounds of the curve.
183 //!
184 //! Raised only for the "OffsetCurve" if it is not possible to
185 //! compute the current point. For example when the first
186 //! derivative on the basis curve and the offset direction
187 //! are parallel.
188 Standard_EXPORT virtual void D0 (const Standard_Real U, gp_Pnt& P) const = 0;
189
190
191 //! Returns the point P of parameter U and the first derivative V1.
192 //! Raised if the continuity of the curve is not C1.
193 Standard_EXPORT virtual void D1 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1) const = 0;
194
195
196 //! Returns the point P of parameter U, the first and second
197 //! derivatives V1 and V2.
198 //! Raised if the continuity of the curve is not C2.
199 Standard_EXPORT virtual void D2 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2) const = 0;
200
201
202 //! Returns the point P of parameter U, the first, the second
203 //! and the third derivative.
204 //! Raised if the continuity of the curve is not C3.
205 Standard_EXPORT virtual void D3 (const Standard_Real U, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3) const = 0;
206
207
208 //! The returned vector gives the value of the derivative for the
209 //! order of derivation N.
210 //! Raised if the continuity of the curve is not CN.
211 //!
212 //! Raised if the derivative cannot be computed
213 //! easily. e.g. rational bspline and n > 3.
214 //! Raised if N < 1.
215 Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Integer N) const = 0;
216
217 //! Computes the point of parameter U on <me>.
218 //! If the curve is periodic then the returned point is P(U) with
219 //! U = Ustart + (U - Uend) where Ustart and Uend are the
220 //! parametric bounds of the curve.
221 //! it is implemented with D0.
222 //!
223 //! Raised only for the "OffsetCurve" if it is not possible to
224 //! compute the current point. For example when the first
225 //! derivative on the basis curve and the offset direction are parallel.
226 Standard_EXPORT gp_Pnt Value (const Standard_Real U) const;
227
228
229
230
92efcf78 231 DEFINE_STANDARD_RTTIEXT(Geom_Curve,Geom_Geometry)
42cf5bc1 232
233protected:
234
235
236
237
238private:
239
240
241
242
243};
244
245
246
247
248
249
250
251#endif // _Geom_Curve_HeaderFile