1 -- File: Geom_OffsetCurve.cdl
2 -- Created: Wed Mar 10 09:48:36 1993
5 -- Copyright: Matra Datavision 1993
8 class OffsetCurve from Geom inherits Curve from Geom
12 -- This class implements the basis services for an offset curve
13 -- in 3D space. The Offset curve in this package can be a self
14 -- intersecting curve even if the basis curve does not
15 -- self-intersect. The self intersecting portions are not deleted
16 -- at the construction time.
17 -- An offset curve is a curve at constant distance (Offset) from
18 -- a basis curve in a reference direction V. The offset curve
19 -- takes its parametrization from the basis curve.
20 -- The Offset curve is in the direction of of the normal N
21 -- defined with the cross product V^T where the vector T
22 -- is given by the first derivative on the basis curve with
24 -- The distance offset may be positive or negative to indicate the
25 -- preferred side of the curve :
26 -- . distance offset >0 => the curve is in the direction of N
27 -- . distance offset >0 => the curve is in the direction of - N
29 -- On the Offset curve :
30 -- Value (U) = BasisCurve.Value(U) + (Offset * (T ^ V)) / ||T ^ V||
32 -- At any point the Offset direction V must not be parallel to the
33 -- vector T and the vector T must not have null length else the
34 -- offset curve is not defined. So the offset curve has not the
35 -- same continuity as the basis curve.
39 -- In this package we suppose that the continuity of the offset
40 -- curve is one degree less than the continuity of the basis
41 -- curve and we don't check that at any point ||T^V|| != 0.0
43 -- So to evaluate the curve it is better to check that the offset
44 -- curve is well defined at any point because an exception could
45 -- be raised. The check is not done in this package at the creation
46 -- of the offset curve because the control needs the use of an
47 -- algorithm which cannot be implemented in this package.
49 -- The OffsetCurve is closed if the first point and the last point
50 -- are the same (The distance between these two points is lower or
51 -- equal to the Resolution sea package gp) . The OffsetCurve can be
52 -- closed even if the basis curve is not closed.
64 raises ConstructionError from Standard,
65 RangeError from Standard,
66 NoSuchObject from Standard,
67 UndefinedDerivative from Geom,
68 UndefinedValue from Geom
78 Create (C : Curve from Geom; Offset : Real; V : Dir)
79 returns mutable OffsetCurve
81 -- C is the basis curve, Offset is the distance between <me> and
82 -- the basis curve at any point. V defines the fixed reference
83 -- direction (offset direction). If P is a point on the basis
84 -- curve and T the first derivative with non zero length
85 -- at this point, the corresponding point on the offset curve is
86 -- in the direction of the vector-product N = V ^ T where
87 -- N is a unitary vector.
89 -- In this package the entities are not shared. The OffsetCurve is
90 -- built with a copy of the curve C. So when C is modified the
91 -- OffsetCurve is not modified
92 raises ConstructionError;
94 -- Raised if the basis curve C is not at least C1.
96 -- No check is done to know if ||V^T|| != 0.0 at any point.
100 Reverse (me : mutable);
101 ---Purpose : Changes the orientation of this offset curve.
103 -- - the basis curve is reversed,
104 -- - the start point of the initial curve becomes the
105 -- end point of the reversed curve,
106 -- - the end point of the initial curve becomes the
107 -- start point of the reversed curve, and
108 -- - the first and last parameters are recomputed.
111 ReversedParameter(me; U : Real) returns Real;
112 ---Purpose: Computes the parameter on the reversed curve for
113 -- the point of parameter U on this offset curve.
116 SetBasisCurve (me : mutable; C : Curve from Geom)
117 raises ConstructionError;
118 ---Purpose : Changes this offset curve by assigning C as the basis curve from which it is built.
120 -- Standard_ConstructionError if the curve C is not at least "C1" continuous.
123 SetDirection (me : mutable; V : Dir);
124 ---Purpose : Changes this offset curve by assigning V as the
125 -- reference vector used to compute the offset direction.
127 SetOffsetValue (me : mutable; D : Real);
128 ---Purpose : Changes this offset curve by assigning D as the offset value.
131 BasisCurve (me) returns Curve from Geom;
132 ---Purpose : Returns the basis curve of this offset curve.
133 -- Note: The basis curve can be an offset curve.
136 Continuity (me) returns Shape from GeomAbs;
137 ---Purpose : Returns the global continuity of this offset curve as a
138 -- value of the GeomAbs_Shape enumeration.
139 -- The degree of continuity of this offset curve is equal
140 -- to the degree of continuity of the basis curve minus 1.
141 -- Continuity of the Offset curve :
142 -- C0 : only geometric continuity,
143 -- C1 : continuity of the first derivative all along the Curve,
144 -- C2 : continuity of the second derivative all along the Curve,
145 -- C3 : continuity of the third derivative all along the Curve,
146 -- G1 : tangency continuity all along the Curve,
147 -- G2 : curvature continuity all along the Curve,
148 -- CN : the order of continuity is infinite.
150 -- Returns the continuity of the basis curve - 1.
151 -- The offset curve must have a unique offset direction defined
155 Direction (me) returns Dir;
156 ---Purpose : Returns the reference vector of this offset curve.
157 ---C++: return const&
159 ---Purpose : Value and derivatives
161 -- The exception UndefinedValue or UndefinedDerivative is
162 -- raised if it is not possible to compute a unique offset
164 -- If T is the first derivative with not null length and
165 -- V the offset direction the relation ||T(U) ^ V|| != 0
166 -- must be satisfied to evaluate the offset curve.
167 -- No check is done at the creation time and we suppose
168 -- in this package that the offset curve is well defined.
171 D0(me; U : Real; P : out Pnt);
172 ---Purpose: Warning! this should not be called
173 -- if the basis curve is not at least C1. Nevertheless
174 -- if used on portion where the curve is C1, it is OK
177 D1 (me; U : Real; P : out Pnt; V1 : out Vec)
178 raises UndefinedDerivative;
179 ---Purpose: Warning! this should not be called
180 -- if the continuity of the basis curve is not C2.
181 -- Nevertheless, it's OK to use it on portion
182 -- where the curve is C2
185 D2 (me; U : Real; P : out Pnt; V1, V2 : out Vec)
186 raises UndefinedDerivative;
187 ---Purpose: Warning! this should not be called
188 -- if the continuity of the basis curve is not C3.
189 -- Nevertheless, it's OK to use it on portion
190 -- where the curve is C3
194 D3 (me; U : Real; P : out Pnt; V1, V2, V3 : out Vec)
195 raises UndefinedDerivative;
197 -- this should not be called
198 -- if the continuity of the basis curve is not C4.
199 -- Nevertheless, it's OK to use it on portion
200 -- where the curve is C4
205 DN (me; U : Real; N : Integer) returns Vec
207 -- The returned vector gives the value of the derivative
208 -- for the order of derivation N.
210 -- this should not be called
211 -- if the continuity of the basis curve is not CN+1.
212 -- Nevertheless, it's OK to use it on portion
213 -- where the curve is CN+1
215 raises UndefinedDerivative,
221 -- The following functions compute the value and derivatives
222 -- on the offset curve and returns the derivatives on the
224 -- The computation of the value and derivatives on the basis
225 -- curve are used to evaluate the offset curve
228 -- The exception UndefinedValue or UndefinedDerivative is
229 -- raised if it is not possible to compute a unique offset
233 ---Purpose : Raised if N < 1.
236 Value (me; U : Real; P, Pbasis : out Pnt; V1basis : out Vec)
237 raises UndefinedValue;
239 ---Purpose: Warning! this should not be called
240 -- if the basis curve is not at least C1. Nevertheless
241 -- if used on portion where the curve is C1, it is OK
243 D0 (me; U : Real; P, Pbasis : out Pnt; V1basis : out Vec)
244 raises UndefinedValue;
245 ---Purpose: Warning! this should not be called
246 -- if the continuity of the basis curve is not C1.
247 -- Nevertheless, it's OK to use it on portion
248 -- where the curve is C1
252 D1 (me; U : Real; P, Pbasis : out Pnt; V1, V1basis, V2basis : out Vec)
253 raises UndefinedDerivative;
254 ---Purpose: Warning! this should not be called
255 -- if the continuity of the basis curve is not C1.
256 -- Nevertheless, it's OK to use it on portion
257 -- where the curve is C1
259 D2 (me; U : Real; P, Pbasis : out Pnt; V1, V2, V1basis, V2basis,
261 raises UndefinedDerivative;
263 ---Purpose: Warning! this should not be called
264 -- if the continuity of the basis curve is not C3.
265 -- Nevertheless, it's OK to use it on portion
266 -- where the curve is C3
267 FirstParameter (me) returns Real;
269 LastParameter (me) returns Real;
271 --- Purpose: Returns the value of the first or last parameter of this
272 -- offset curve. The first parameter corresponds to the
273 -- start point of the curve. The last parameter
274 -- corresponds to the end point.
275 -- Note: the first and last parameters of this offset curve
276 -- are also the ones of its basis curve.
278 Offset (me) returns Real;
279 ---Purpose: Returns the offset value of this offset curve.
281 IsClosed (me) returns Boolean;
282 ---Purpose : Returns True if the distance between the start point
283 -- and the end point of the curve is lower or equal to
284 -- Resolution from package gp.
287 IsCN (me; N : Integer) returns Boolean
288 ---Purpose : Returns true if the degree of continuity of the basis
289 -- curve of this offset curve is at least N + 1.
290 -- This method answer True if the continuity of the basis curve
291 -- is N + 1. We suppose in this class that a normal direction
292 -- to the basis curve (used to compute the offset curve) is
293 -- defined at any point on the basis curve.
295 ---Purpose : Raised if N < 0.
298 IsPeriodic (me) returns Boolean;
299 ---Purpose : Returns true if this offset curve is periodic, i.e. if the
300 -- basis curve of this offset curve is periodic.
303 Period (me) returns Real from Standard
304 ---Purpose: Returns the period of this offset curve, i.e. the period
305 -- of the basis curve of this offset curve.
307 -- Standard_NoSuchObject if the basis curve is not periodic.
309 NoSuchObject from Standard
313 Transform (me : mutable; T : Trsf);
314 --- Purpose: Applies the transformation T to this offset curve.
315 -- Note: the basis curve is also modified.
317 TransformedParameter(me; U : Real; T : Trsf from gp) returns Real
318 ---Purpose: Returns the parameter on the transformed curve for
319 -- the transform of the point of parameter U on <me>.
320 -- me->Transformed(T)->Value(me->TransformedParameter(U,T))
321 -- is the same point as
322 -- me->Value(U).Transformed(T)
323 -- This methods calls the basis curve method.
326 ParametricTransformation(me; T : Trsf from gp) returns Real
327 ---Purpose: Returns a coefficient to compute the parameter on
328 -- the transformed curve for the transform of the
331 -- Transformed(T)->Value(U * ParametricTransformation(T))
332 -- is the same point as
333 -- Value(U).Transformed(T)
334 -- This methods calls the basis curve method.
339 Copy (me) returns mutable like me;
340 ---Purpose: Creates a new object which is a copy of this offset curve.
344 basisCurve : Curve from Geom;