1 -- Created on: 1993-03-24
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 deferred class Curve from Geom2d inherits Geometry from Geom2d
25 --- Purpose : The abstract class Curve describes the common
26 -- behavior of curves in 2D space. The Geom2d
27 -- package provides numerous concrete classes of
28 -- derived curves, including lines, circles, conics, Bezier
29 -- or BSpline curves, etc.
30 -- The main characteristic of these curves is that they
31 -- are parameterized. The Geom2d_Curve class shows:
32 -- - how to work with the parametric equation of a
33 -- curve in order to calculate the point of parameter
34 -- u, together with the vector tangent and the
35 -- derivative vectors of order 2, 3,..., N at this point;
36 -- - how to obtain general information about the curve
37 -- (for example, level of continuity, closed
38 -- characteristics, periodicity, bounds of the parameter field);
39 -- - how the parameter changes when a geometric
40 -- transformation is applied to the curve or when the
41 -- orientation of the curve is inverted.
42 -- All curves must have a geometric continuity: a curve is
43 -- at least "C0". Generally, this property is checked at
44 -- the time of construction or when the curve is edited.
45 -- Where this is not the case, the documentation
46 -- explicitly states so.
48 -- The Geom2d package does not prevent the
49 -- construction of curves with null length or curves which
60 raises RangeError from Standard,
61 NoSuchObject from Standard,
62 UndefinedDerivative from Geom2d,
63 UndefinedValue from Geom2d
70 Reverse (me : mutable)
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.
81 ReversedParameter(me; U : Real) returns Real
82 ---Purpose: Computes the parameter on the reversed curve for
83 -- the point of parameter U on this curve.
84 -- Note: The point of parameter U on this curve is
85 -- identical to the point of parameter
86 -- ReversedParameter(U) on the reversed curve.
90 TransformedParameter(me; U : Real; T : Trsf2d from gp) returns Real
91 ---Purpose: Computes the parameter on the curve transformed by
92 -- T for the point of parameter U on this curve.
93 -- Note: this function generally returns U but it can be
94 -- redefined (for example, on a line).
97 ParametricTransformation(me; T : Trsf2d from gp) returns Real
98 ---Purpose: Returns the coefficient required to compute the
99 -- parametric transformation of this curve when
100 -- transformation T is applied. This coefficient is the
101 -- ratio between the parameter of a point on this curve
102 -- and the parameter of the transformed point on the
103 -- new curve transformed by T.
104 -- Note: this function generally returns 1. but it can be
105 -- redefined (for example, on a line).
108 Reversed (me) returns mutable like me
109 --- Purpose : Creates a reversed duplicate Changes the orientation of this curve. The first and
110 -- last parameters are not changed, but the parametric
111 -- direction of the curve is reversed.
112 -- If the curve is bounded:
113 -- - the start point of the initial curve becomes the end
114 -- point of the reversed curve, and
115 -- - the end point of the initial curve becomes the start
116 -- point of the reversed curve.
117 -- - Reversed creates a new curve.
122 FirstParameter (me) returns Real
123 --- Purpose : Returns the value of the first parameter.
125 -- It can be RealFirst or RealLast from package Standard
126 -- if the curve is infinite
130 LastParameter (me) returns Real
131 --- Purpose : Value of the last parameter.
133 -- It can be RealFirst or RealLast from package Standard
134 -- if the curve is infinite
138 IsClosed (me) returns Boolean
139 --- Purpose : Returns true if the curve is closed.
141 -- Some curves such as circle are always closed, others such as line
142 -- are never closed (by definition).
143 -- Some Curves such as OffsetCurve can be closed or not. These curves
144 -- are considered as closed if the distance between the first point
145 -- and the last point of the curve is lower or equal to the Resolution
146 -- from package gp wich is a fixed criterion independant of the
151 IsPeriodic (me) returns Boolean
153 -- Returns true if the parameter of the curve is periodic.
154 -- It is possible only if the curve is closed and if the
155 -- following relation is satisfied :
156 -- for each parametric value U the distance between the point
157 -- P(u) and the point P (u + T) is lower or equal to Resolution
158 -- from package gp, T is the period and must be a constant.
159 -- There are three possibilities :
160 -- . the curve is never periodic by definition (SegmentLine)
161 -- . the curve is always periodic by definition (Circle)
162 -- . the curve can be defined as periodic (BSpline). In this case
163 -- a function SetPeriodic allows you to give the shape of the
164 -- curve. The general rule for this case is : if a curve can be
165 -- periodic or not the default periodicity set is non periodic
166 -- and you have to turn (explicitly) the curve into a periodic
167 -- curve if you want the curve to be periodic.
171 Period (me) returns Real from Standard
172 ---Purpose: Returns thne period of this curve.
174 NoSuchObject from Standard
175 ---Purpose: raises if the curve is not periodic
178 Continuity (me) returns Shape from GeomAbs
180 -- It is the global continuity of the curve :
181 -- C0 : only geometric continuity,
182 -- C1 : continuity of the first derivative all along the Curve,
183 -- C2 : continuity of the second derivative all along the Curve,
184 -- C3 : continuity of the third derivative all along the Curve,
185 -- G1 : tangency continuity all along the Curve,
186 -- G2 : curvature continuity all along the Curve,
187 -- CN : the order of continuity is infinite.
191 IsCN (me; N : Integer) returns Boolean
192 --- Purpose : Returns true if the degree of continuity of this curve is at least N.
193 -- Exceptions Standard_RangeError if N is less than 0.
198 D0(me; U : Real; P : out Pnt2d)
199 ---Purpose: Returns in P the point of parameter U.
200 -- If the curve is periodic then the returned point is P(U) with
201 -- U = Ustart + (U - Uend) where Ustart and Uend are the
202 -- parametric bounds of the curve.
203 raises UndefinedValue
205 -- Raised only for the "OffsetCurve" if it is not possible to
206 -- compute the current point. For example when the first
207 -- derivative on the basis curve and the offset direction
212 D1 (me; U : Real; P : out Pnt2d; V1 : out Vec2d)
214 -- Returns the point P of parameter U and the first derivative V1.
215 raises UndefinedDerivative
216 --- Purpose : Raised if the continuity of the curve is not C1.
220 D2 (me; U : Real; P : out Pnt2d; V1, V2 : out Vec2d)
222 -- Returns the point P of parameter U, the first and second
223 -- derivatives V1 and V2.
224 raises UndefinedDerivative
225 --- Purpose : Raised if the continuity of the curve is not C2.
229 D3 (me; U : Real; P : out Pnt2d; V1, V2, V3 : out Vec2d)
231 -- Returns the point P of parameter U, the first, the second
232 -- and the third derivative.
233 raises UndefinedDerivative
234 --- Purpose : Raised if the continuity of the curve is not C3.
238 DN (me; U : Real; N : Integer) returns Vec2d
239 --- Purpose : For the point of parameter U of this curve, computes
240 -- the vector corresponding to the Nth derivative.
242 -- StdFail_UndefinedDerivative if:
243 -- - the continuity of the curve is not "CN", or
244 -- - the derivative vector cannot be computed easily;
245 -- this is the case with specific types of curve (for
246 -- example, a rational BSpline curve where N is greater than 3).
247 -- Standard_RangeError if N is less than 1.
248 raises UndefinedDerivative,
253 Value (me; U : Real) returns Pnt2d
254 --- Purpose : Computes the point of parameter U on <me>.
255 -- If the curve is periodic then the returned point is P(U) with
256 -- U = Ustart + (U - Uend) where Ustart and Uend are the
257 -- parametric bounds of the curve.
259 -- it is implemented with D0.
260 raises UndefinedValue
262 -- Raised only for the "OffsetCurve" if it is not possible to
263 -- compute the current point. For example when the first
264 -- derivative on the basis curve and the offset direction