0024830: Remove redundant keyword 'mutable' in CDL declarations
[occt.git] / src / Geom2d / Geom2d_BSplineCurve.cdl
1 -- Created on: 1993-03-24
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 -- xab : modified 15-Mar-95 : added cache mecanism to speed up
18 -- evaluation
19
20
21 class BSplineCurve from Geom2d inherits BoundedCurve from Geom2d
22
23         --- Purpose : Describes a BSpline curve.
24         -- A BSpline curve can be:
25         -- - uniform or non-uniform,
26         -- - rational or non-rational,
27         -- - periodic or non-periodic.
28         -- A BSpline curve is defined by:
29         -- - its degree; the degree for a
30         --   Geom2d_BSplineCurve is limited to a value (25)
31         --   which is defined and controlled by the system. This
32         --   value is returned by the function MaxDegree;
33         -- - its periodic or non-periodic nature;
34         -- - a table of poles (also called control points), with
35         --   their associated weights if the BSpline curve is
36         --   rational. The poles of the curve are "control points"
37         --   used to deform the curve. If the curve is
38         --   non-periodic, the first pole is the start point of the
39         --   curve, and the last pole is the end point of the
40         --   curve. The segment, which joins the first pole to the
41         --   second pole, is the tangent to the curve at its start
42         --   point, and the segment, which joins the last pole to
43         --   the second-from-last pole, is the tangent to the
44         --   curve at its end point. If the curve is periodic, these
45         --   geometric properties are not verified. It is more
46         --   difficult to give a geometric signification to the
47         --   weights but they are useful for providing exact
48         --   representations of the arcs of a circle or ellipse.
49         --   Moreover, if the weights of all the poles are equal,
50         --   the curve has a polynomial equation; it is
51         --   therefore a non-rational curve.
52         -- - a table of knots with their multiplicities. For a
53         --   Geom2d_BSplineCurve, the table of knots is an
54         --   increasing sequence of reals without repetition; the
55         --   multiplicities define the repetition of the knots. A
56         --   BSpline curve is a piecewise polynomial or rational
57         --   curve. The knots are the parameters of junction
58         --   points between two pieces. The multiplicity
59         --   Mult(i) of the knot Knot(i) of the BSpline
60         --   curve is related to the degree of continuity of the
61         --   curve at the knot Knot(i), which is equal to
62         --   Degree - Mult(i) where Degree is the
63         --   degree of the BSpline curve.
64         -- If the knots are regularly spaced (i.e. the difference
65         -- between two consecutive knots is a constant), three
66         -- specific and frequently used cases of knot distribution
67         -- can be identified:
68         -- - "uniform" if all multiplicities are equal to 1,
69         -- - "quasi-uniform" if all multiplicities are equal to 1,
70         --   except the first and the last knot which have a
71         --   multiplicity of Degree + 1, where Degree is
72         --   the degree of the BSpline curve,
73         -- - "Piecewise Bezier" if all multiplicities are equal to
74         --  Degree except the first and last knot which have
75         --   a multiplicity of Degree + 1, where Degree is
76         --   the degree of the BSpline curve. A curve of this
77         --   type is a concatenation of arcs of Bezier curves.
78         -- If the BSpline curve is not periodic:
79         -- - the bounds of the Poles and Weights tables are 1
80         --   and NbPoles, where NbPoles is the number of
81         --   poles of the BSpline curve,
82         -- - the bounds of the Knots and Multiplicities tables are
83         --   1 and NbKnots, where NbKnots is the number
84         --   of knots of the BSpline curve.
85         -- If the BSpline curve is periodic, and if there are k
86         -- periodic knots and p periodic poles, the period is:
87         -- period = Knot(k + 1) - Knot(1)
88         -- and the poles and knots tables can be considered as
89         -- infinite tables, such that:
90         -- - Knot(i+k) = Knot(i) + period
91         -- - Pole(i+p) = Pole(i)
92         -- Note: data structures of a periodic BSpline curve are
93         -- more complex than those of a non-periodic one.
94         -- Warnings :
95         --  In this class we consider that a weight value is zero if
96         --  Weight <= Resolution from package gp.
97         --  For two parametric values (or two knot values) U1, U2 we 
98         --  consider that U1 = U2 if Abs (U2 - U1) <= Epsilon (U1).
99         --  For two weights values W1, W2 we consider that W1 = W2 if
100         --  Abs (W2 - W1) <= Epsilon (W1).  The method Epsilon is
101         --  defined in the class Real from package Standard.
102         --  
103         -- References :
104         --  . A survey of curve and surface methods in CADG Wolfgang BOHM
105         --    CAGD 1 (1984)
106         --  . On de Boor-like algorithms and blossoming Wolfgang BOEHM
107         --    cagd 5 (1988)
108         --  . Blossoming and knot insertion algorithms for B-spline curves
109         --    Ronald N. GOLDMAN
110         --  . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA   
111         --  . Curves and Surfaces for Computer Aided Geometric Design,
112         --    a practical guide Gerald Farin
113
114
115 uses  Array1OfInteger      from TColStd,
116       Array1OfReal         from TColStd,
117       HArray1OfInteger     from TColStd,
118       HArray1OfReal        from TColStd,
119       Array1OfPnt2d        from TColgp,
120       Ax2d                 from gp, 
121       Pnt2d                from gp,
122       HArray1OfPnt2d       from TColgp,
123       Trsf2d               from gp,
124       Vec2d                from gp,
125       BSplKnotDistribution from GeomAbs,
126       Geometry             from Geom2d,
127       Shape                from GeomAbs,
128       Mutex                from Standard
129
130 raises ConstructionError   from Standard,
131        DimensionError      from Standard,
132        DomainError         from Standard,
133        OutOfRange          from Standard,
134        RangeError          from Standard,
135        NoSuchObject        from Standard,
136        UndefinedDerivative from Geom2d
137
138 is
139
140
141
142   Create (Poles          : Array1OfPnt2d   from TColgp; 
143           Knots          : Array1OfReal    from TColStd; 
144           Multiplicities : Array1OfInteger from TColStd; 
145           Degree         : Integer;
146           Periodic       : Boolean = Standard_False)
147           
148   returns BSplineCurve from Geom2d
149
150         ---Purpose :  Creates a  non-rational B_spline curve   on  the
151         --         basis <Knots, Multiplicities> of degree <Degree>.
152         -- The following conditions must be verified.
153         --  0 < Degree <= MaxDegree.
154         --  
155         --  Knots.Length() == Mults.Length() >= 2
156         --  
157         --  Knots(i) < Knots(i+1) (Knots are increasing)
158         --  
159         --  1 <= Mults(i) <= Degree
160         --  
161         --   On a non periodic curve the first and last multiplicities
162         --   may be Degree+1 (this is even recommanded if you want the
163         --   curve to start and finish on the first and last pole).
164         --   
165         --   On a periodic  curve the first  and  the last multicities
166         --   must be the same.
167         --   
168         --   on non-periodic curves
169         --   
170         --     Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2
171         --     
172         --   on periodic curves 
173         --   
174         --     Poles.Length() == Sum(Mults(i)) except the first or last
175
176   raises ConstructionError;
177
178         
179
180   Create (Poles          : Array1OfPnt2d   from TColgp; 
181           Weights        : Array1OfReal    from TColStd;
182           Knots          : Array1OfReal    from TColStd; 
183           Multiplicities : Array1OfInteger from TColStd; 
184           Degree         : Integer;
185           Periodic       : Boolean = Standard_False)
186           
187   returns BSplineCurve from Geom2d
188
189         ---Purpose : Creates  a rational B_spline  curve  on the basis
190         --         <Knots, Multiplicities> of degree <Degree>.
191         -- The following conditions must be verified.
192         --  0 < Degree <= MaxDegree.
193         --  
194         --  Knots.Length() == Mults.Length() >= 2
195         --  
196         --  Knots(i) < Knots(i+1) (Knots are increasing)
197         --  
198         --  1 <= Mults(i) <= Degree
199         --  
200         --   On a non periodic curve the first and last multiplicities
201         --   may be Degree+1 (this is even recommanded if you want the
202         --   curve to start and finish on the first and last pole).
203         --   
204         --   On a periodic  curve the first  and  the last multicities
205         --   must be the same.
206         --   
207         --   on non-periodic curves
208         --   
209         --     Poles.Length() == Sum(Mults(i)) - Degree - 1 >= 2
210         --     
211         --   on periodic curves 
212         --   
213         --     Poles.Length() == Sum(Mults(i)) except the first or last
214
215   raises ConstructionError;
216
217    
218   IncreaseDegree (me : mutable; Degree : Integer)
219   
220         ---Purpose: Increases the degree of this BSpline curve to
221         -- Degree. As a result, the poles, weights and
222         -- multiplicities tables are modified; the knots table is
223         -- not changed. Nothing is done if Degree is less than
224         -- or equal to the current degree.
225         -- Exceptions
226         -- Standard_ConstructionError if Degree is greater than
227         -- Geom2d_BSplineCurve::MaxDegree().
228   raises ConstructionError;
229        
230
231  IncreaseMultiplicity (me : mutable; Index : Integer; M : Integer)
232  
233         ---Purpose :Increases the multiplicity  of the knot <Index> to
234         --         <M>.   
235         --         
236         --         If   <M>   is   lower   or  equal   to  the current
237         --         multiplicity nothing is done. If <M> is higher than
238         --         the degree the degree is used.
239
240  raises OutOfRange;
241         
242         ---Purpose: If <Index> is not in [FirstUKnotIndex, LastUKnotIndex]
243
244
245   IncreaseMultiplicity (me : mutable; I1, I2 : Integer; M : Integer) 
246   
247         ---Purpose :Increases  the  multiplicities   of  the knots  in
248         --         [I1,I2] to <M>.
249         --         
250         --         For each knot if  <M>  is  lower  or equal  to  the
251         --         current multiplicity  nothing  is  done. If <M>  is
252         --         higher than the degree the degree is used.
253         -- As a result, the poles and weights tables of this curve are modified.
254         -- Warning
255         -- It is forbidden to modify the multiplicity of the first or
256         -- last knot of a non-periodic curve. Be careful as
257         -- Geom2d does not protect against this.
258         -- Exceptions
259         -- Standard_OutOfRange if either Index, I1 or I2 is
260         -- outside the bounds of the knots table.
261  raises OutOfRange;
262         
263
264   IncrementMultiplicity (me : mutable; I1, I2 : Integer; M : Integer) 
265   
266         ---Purpose : Increases by M the multiplicity of the knots of indexes
267         -- I1 to I2 in the knots table of this BSpline curve. For
268         -- each knot, the resulting multiplicity is limited to the
269         -- degree of this curve. If M is negative, nothing is done.
270         -- As a result, the poles and weights tables of this
271         -- BSpline curve are modified.
272         -- Warning
273         -- It is forbidden to modify the multiplicity of the first or
274         -- last knot of a non-periodic curve. Be careful as
275         -- Geom2d does not protect against this.
276         -- Exceptions
277         -- Standard_OutOfRange if I1 or I2 is outside the
278         -- bounds of the knots table.
279
280  raises OutOfRange;
281         
282
283   InsertKnot (me : mutable; 
284               U : Real; 
285               M : Integer = 1; 
286               ParametricTolerance : Real = 0.0); 
287   
288         ---Purpose: Inserts a knot value in the sequence of knots.  If
289         --          <U>  is an  existing knot     the multiplicity  is
290         --          increased by <M>.
291         --          
292         --          If U  is  not  on the parameter  range  nothing is
293         --          done.
294         --          
295         --          If the multiplicity is negative or null nothing is
296         --          done. The  new   multiplicity  is limited  to  the
297         --          degree.
298         --          
299         --          The  tolerance criterion  for  knots  equality  is
300         --          the max of Epsilon(U) and ParametricTolerance.
301         -- Warning
302         -- - If U is less than the first parameter or greater than
303         --   the last parameter of this BSpline curve, nothing is done.
304         -- - If M is negative or null, nothing is done.
305         -- - The multiplicity of a knot is limited to the degree of
306         --   this BSpline curve.
307   
308
309   InsertKnots (me : mutable; Knots : Array1OfReal    from TColStd; 
310                              Mults : Array1OfInteger from TColStd;
311                              ParametricTolerance : Real = 0.0;
312                              Add : Boolean = Standard_False);
313                              
314         ---Purpose: Inserts the values of the array Knots, with the
315         -- respective multiplicities given by the array Mults, into
316         -- the knots table of this BSpline curve.
317         -- If a value of the array Knots is an existing knot, its multiplicity is:
318         -- - increased by M, if Add is true, or
319         -- - increased to M, if Add is false (default value).
320         -- The tolerance criterion used for knot equality is the
321         -- larger of the values ParametricTolerance (defaulted
322         -- to 0.) and Standard_Real::Epsilon(U),
323         -- where U is the current knot value.
324         -- Warning
325         -- - For a value of the array Knots which is less than
326         --   the first parameter or greater than the last
327         --   parameter of this BSpline curve, nothing is done.
328         -- - For a value of the array Mults which is negative or
329         --   null, nothing is done.
330         -- - The multiplicity of a knot is limited to the degree of
331         --   this BSpline curve.
332                              
333
334
335   RemoveKnot(me : mutable; Index     : Integer; 
336                            M         : Integer;
337                            Tolerance : Real) returns Boolean
338                            
339         ---Purpose : Reduces the multiplicity of the knot of index Index
340         -- to M. If M is equal to 0, the knot is removed.
341         -- With a modification of this type, the array of poles is also modified.
342         -- Two different algorithms are systematically used to
343         -- compute the new poles of the curve. If, for each
344         -- pole, the distance between the pole calculated
345         -- using the first algorithm and the same pole
346         -- calculated using the second algorithm, is less than
347         -- Tolerance, this ensures that the curve is not
348         -- modified by more than Tolerance. Under these
349         -- conditions, true is returned; otherwise, false is returned.
350         -- A low tolerance is used to prevent modification of
351         -- the curve. A high tolerance is used to "smooth" the curve.
352         -- Exceptions
353         -- Standard_OutOfRange if Index is outside the
354         -- bounds of the knots table.
355      raises OutOfRange;
356      
357
358   InsertPoleAfter (me : mutable; Index : Integer; P : Pnt2d;
359                    Weight : Real = 1.0)
360         --- Purpose :
361         --  The new pole is inserted after the pole of range Index.
362         --  If the curve was non rational it can become rational.
363      raises ConstructionError,
364         --- Purpose :
365         --  Raised if the B-spline is NonUniform or PiecewiseBezier or if
366         --  Weight <= 0.0
367             OutOfRange;
368         --- Purpose : Raised if Index is not in the range [1, Number of Poles]
369
370
371   InsertPoleBefore (me : mutable; Index : Integer; P : Pnt2d; 
372                     Weight : Real  =  1.0)
373         --- Purpose :
374         --  The new pole is inserted before the pole of range Index.
375         --  If the curve was non rational it can become rational.
376      raises ConstructionError,
377         --- Purpose :
378         --  Raised if the B-spline is NonUniform or PiecewiseBezier or if
379         --  Weight <= 0.0
380             OutOfRange;
381         --- Purpose : Raised if Index is not in the range [1, Number of Poles]
382
383
384   RemovePole (me : mutable; Index : Integer)
385         --- Purpose :
386         --  Removes the pole of range Index
387         --  If the curve was rational it can become non rational.
388      raises ConstructionError,
389         --- Purpose :
390         --  Raised if the B-spline is NonUniform or PiecewiseBezier.
391         --  Raised if the number of poles of the B-spline curve is lower or 
392         --  equal to 2 before removing.
393             OutOfRange;
394         --- Purpose : Raised if Index is not in the range [1, Number of Poles]
395
396   Reverse (me : mutable);
397         --- Purpose : Reverses the orientation of this BSpline curve. As a result
398         -- - the knots and poles tables are modified;
399         -- - the start point of the initial curve becomes the end
400         --   point of the reversed curve;
401         -- - the end point of the initial curve becomes the start
402         --   point of the reversed curve.
403         
404
405   ReversedParameter(me; U : Real) returns Real;
406         ---Purpose: Computes the parameter on the reversed curve for
407         -- the point of parameter U on this BSpline curve.
408         -- The returned value is: UFirst + ULast - U,
409         -- where UFirst and ULast are the values of the
410         -- first and last parameters of this BSpline curve.
411
412
413   Segment (me : mutable; U1, U2 : Real)
414         ---Purpose : Modifies this BSpline curve by segmenting it
415         -- between U1 and U2. Either of these values can be
416         -- outside the bounds of the curve, but U2 must be greater than U1.
417         -- All data structure tables of this BSpline curve are
418         -- modified, but the knots located between U1 and U2
419         -- are retained. The degree of the curve is not modified.
420         -- Warnings :
421         --  Even if <me> is not closed it can become closed after the 
422         --  segmentation for example if U1 or U2 are out of the bounds 
423         --  of the curve <me> or if the curve makes loop.
424         --  After the segmentation the length of a curve can be null.
425         --        - The segmentation of a periodic curve over an
426         ---   interval corresponding to its period generates a
427         --  non-periodic curve with equivalent geometry.
428         --  Exceptions
429         -- Standard_DomainError if U2 is less than U1.
430     raises DomainError from Standard;
431         ---Purpose: raises if U2 < U1.
432
433
434   SetKnot (me : mutable; Index : Integer; K : Real)
435         --- Purpose :  Modifies this BSpline curve by assigning the value K
436         -- to the knot of index Index in the knots table. This is a
437         -- relatively local modification because K must be such that:
438         -- Knots(Index - 1) < K < Knots(Index + 1)
439         -- Exceptions
440         -- Standard_ConstructionError if:
441         -- - K is not such that:
442         -- Knots(Index - 1) < K < Knots(Index + 1)
443         -- - M is greater than the degree of this BSpline curve
444         --   or lower than the previous multiplicity of knot of
445         --   index Index in the knots table.
446         -- Standard_OutOfRange if Index is outside the bounds of the knots table.
447      raises ConstructionError,
448                     OutOfRange;
449
450
451   SetKnots (me : mutable; K : Array1OfReal from TColStd)
452         --- Purpose :  Modifies this BSpline curve by assigning the array
453         -- K to its knots table. The multiplicity of the knots is not modified.
454         -- Exceptions
455         -- Standard_ConstructionError if the values in the
456         -- array K are not in ascending order.
457         -- Standard_OutOfRange if the bounds of the array
458         -- K are not respectively 1 and the number of knots of this BSpline curve.
459      raises ConstructionError,
460                     OutOfRange;
461       
462
463   SetKnot (me : mutable; Index : Integer; K : Real; M : Integer)
464         --- Purpose : Modifies this BSpline curve by assigning the value K
465         -- to the knot of index Index in the knots table. This is a
466         -- relatively local modification because K must be such that:
467         -- Knots(Index - 1) < K < Knots(Index + 1)
468         -- The second syntax allows you also to increase the
469         -- multiplicity of the knot to M (but it is not possible to
470         -- decrease the multiplicity of the knot with this function).
471         -- Exceptions
472         -- Standard_ConstructionError if:
473         -- - K is not such that:
474         -- Knots(Index - 1) < K < Knots(Index + 1)
475         -- - M is greater than the degree of this BSpline curve
476         --   or lower than the previous multiplicity of knot of
477         --   index Index in the knots table.
478         -- Standard_OutOfRange if Index is outside the bounds of the knots table.
479      raises ConstructionError,
480                     OutOfRange;
481
482   PeriodicNormalization(me ;  U : in out Real) ; 
483        
484         ---Purpose : Computes the parameter normalized within the
485         -- "first" period of this BSpline curve, if it is periodic:
486         -- the returned value is in the range Param1 and
487         -- Param1 + Period, where:
488         -- - Param1 is the "first parameter", and
489         -- - Period the period of this BSpline curve.
490         --  Note: If this curve is not periodic, U is not modified.
491                  
492   SetPeriodic (me : mutable)
493         --- Purpose :Changes this BSpline curve into a periodic curve.
494         -- To become periodic, the curve must first be closed.
495         -- Next, the knot sequence must be periodic. For this,
496         -- FirstUKnotIndex and LastUKnotIndex are used to
497         -- compute I1 and I2, the indexes in the knots array
498         -- of the knots corresponding to the first and last
499         -- parameters of this BSpline curve.
500         -- The period is therefore Knot(I2) - Knot(I1).
501         -- Consequently, the knots and poles tables are modified.
502         -- Exceptions
503         -- Standard_ConstructionError if this BSpline curve is not closed.
504      raises ConstructionError;
505
506
507   SetOrigin (me : mutable; Index : Integer)
508         ---Purpose: Assigns the knot of index Index in the knots table as
509         -- the origin of this periodic BSpline curve. As a
510         -- consequence, the knots and poles tables are modified.
511         -- Exceptions
512         -- Standard_NoSuchObject if this curve is not periodic.
513         -- Standard_DomainError if Index is outside the
514         -- bounds of the knots table.
515     raises NoSuchObject,
516            DomainError;
517         
518
519   SetNotPeriodic (me : mutable);
520         --- Purpose : Changes this BSpline curve into a non-periodic
521         -- curve. If this curve is already non-periodic, it is not modified.
522         -- Note that the poles and knots tables are modified.
523         -- Warning
524         -- If this curve is periodic, as the multiplicity of the first
525         -- and last knots is not modified, and is not equal to
526         -- Degree + 1, where Degree is the degree of
527         -- this BSpline curve, the start and end points of the
528         -- curve are not its first and last poles.
529                 
530  
531   SetPole (me : mutable; Index : Integer; P : Pnt2d)
532         --- Purpose : Modifies this BSpline curve by assigning P to the
533         -- pole of index Index in the poles table.
534         -- Exceptions
535         -- Standard_OutOfRange if Index is outside the
536         -- bounds of the poles table.
537         -- Standard_ConstructionError if Weight is negative or null.
538      raises OutOfRange;
539       
540
541   SetPole (me : mutable; Index : Integer; P : Pnt2d; Weight : Real)
542         --- Purpose : Modifies this BSpline curve by assigning P to the
543         -- pole of index Index in the poles table.
544         -- The second syntax also allows you to modify the
545         -- weight of the modified pole, which becomes Weight.
546         -- In this case, if this BSpline curve is non-rational, it
547         -- can become rational and vice versa.
548         -- Exceptions
549         -- Standard_OutOfRange if Index is outside the
550         -- bounds of the poles table.
551         -- Standard_ConstructionError if Weight is negative or null.
552      raises OutOfRange,
553                   ConstructionError;
554         
555   SetWeight (me : mutable; Index : Integer; Weight : Real)
556         --- Purpose : Assigns the weight Weight to the pole of index Index of the poles table.
557         --  If the curve was non rational it can become rational.
558         --  If the curve was rational it can become non rational.
559         -- Exceptions
560         -- Standard_OutOfRange if Index is outside the
561         -- bounds of the poles table.
562         -- Standard_ConstructionError if Weight is negative or null.
563     raises OutOfRange,
564                   ConstructionError;
565
566   MovePoint (me : mutable; U: Real; P: Pnt2d; Index1, Index2: Integer;
567              FirstModifiedPole, LastModifiedPole: out Integer)
568         ---Purpose : Moves the point of parameter U of this BSpline
569         -- curve to P. Index1 and Index2 are the indexes in the
570         -- table of poles of this BSpline curve of the first and
571         -- last poles designated to be moved.
572         -- FirstModifiedPole and LastModifiedPole are the
573         -- indexes of the first and last poles, which are
574         -- effectively modified.
575         -- In the event of incompatibility between Index1,
576         -- Index2 and the value U:
577         -- - no change is made to this BSpline curve, and
578         -- - the FirstModifiedPole and LastModifiedPole are returned null.
579         -- Exceptions
580         -- Standard_OutOfRange if:
581         -- - Index1 is greater than or equal to Index2, or
582         -- - Index1 or Index2 is less than 1 or greater than the
583         --   number of poles of this BSpline curve.
584      raises OutOfRange;
585        
586
587     MovePointAndTangent (me : mutable; 
588                        U                 : Real; 
589                        P                 : Pnt2d; 
590                        Tangent           : Vec2d ;
591                        Tolerance         : Real ; 
592                        StartingCondition, 
593                        EndingCondition   : Integer; 
594                        ErrorStatus       : out Integer) 
595
596         ---Purpose : Move a point with parameter U to P.
597         -- and makes it tangent at U be Tangent.
598         -- StartingCondition = -1 means first can move
599         -- EndingCondition   = -1 means last point can move
600         -- StartingCondition = 0 means the first point cannot move
601         -- EndingCondition   = 0 means the last point cannot move
602         -- StartingCondition = 1 means the first point and tangent cannot move
603         -- EndingCondition   = 1 means the last point and tangent cannot move  
604         -- and so forth
605         -- ErrorStatus != 0 means that there are not enought degree of freedom
606         -- with the constrain to deform the curve accordingly
607         
608      raises OutOfRange;
609      
610     
611   IsCN (me; N : Integer)   returns Boolean
612         --- Purpose : Returns true if the degree of continuity of this
613         -- BSpline curve is at least N. A BSpline curve is at least GeomAbs_C0.
614         -- Exceptions Standard_RangeError if N is negative.
615           raises RangeError;
616       
617
618   IsClosed (me)  returns Boolean;
619         --- Purpose :
620         --  Returns true if the distance between the first point and the 
621         --  last point of the curve is lower or equal to Resolution 
622         --  from package gp.
623         --  Warnings :
624         --  The first and the last point can be different from the first
625         --  pole and the last pole of the curve.
626
627
628   IsPeriodic (me)  returns Boolean;
629         --- Purpose : Returns True if the curve is periodic.
630
631
632   IsRational (me)  returns Boolean;
633         --- Purpose :
634         --  Returns True if the weights are not identical.
635         --  The tolerance criterion is Epsilon of the class Real.
636     
637   IsCacheValid(me;  Parameter : Real) returns Boolean
638   
639         ---Purpose :
640         --           Tells whether the Cache is valid for the
641         --           given parameter 
642         -- Warnings : the parameter must be normalized within
643         -- the period if the curve is periodic. Otherwise
644         -- the answer will be false
645         -- 
646         is static private;
647   
648   Continuity (me)  returns Shape from GeomAbs;
649         --- Purpose :
650         --  Returns the global continuity of the curve :
651         --  C0 : only geometric continuity,
652         --  C1 : continuity of the first derivative all along the Curve,
653         --  C2 : continuity of the second derivative all along the Curve,
654         --  C3 : continuity of the third derivative all along the Curve,
655         --  CN : the order of continuity is infinite.
656         --  For a B-spline curve of degree d if a knot Ui has a
657         --  multiplicity p the B-spline curve is only Cd-p continuous 
658         --  at Ui. So the global continuity of the curve can't be greater 
659         --  than Cd-p where p is the maximum multiplicity of the interior
660         --  Knots. In the interior of a knot span the curve is infinitely
661         --  continuously differentiable.
662
663
664   Degree (me)  returns Integer;
665         --- Purpose : Returns the degree of this BSpline curve.
666         --  In this class the degree of the basis normalized B-spline
667         --  functions cannot be greater than "MaxDegree"
668
669
670         --- Purpose : Computation of value and derivatives
671
672   D0 (me; U : Real; P : out Pnt2d);
673
674
675   D1 (me; U : Real; P : out Pnt2d; V1 : out Vec2d)
676      raises UndefinedDerivative;
677         --- Purpose : Raised if the continuity of the curve is not C1.
678
679
680   D2 (me; U : Real; P : out Pnt2d; V1, V2 : out Vec2d)
681      raises UndefinedDerivative;
682         --- Purpose : Raised if the continuity of the curve is not C2.
683
684
685   D3 (me; U : Real; P : out Pnt2d; V1, V2, V3 : out Vec2d)
686      raises UndefinedDerivative;
687         --- Purpose:  For this BSpline curve, computes
688         -- - the point P of parameter U, or
689         -- - the point P and one or more of the following values:
690         --   - V1, the first derivative vector,
691         --   - V2, the second derivative vector,
692         --   - V3, the third derivative vector.
693         -- Warning
694         -- On a point where the continuity of the curve is not the
695         -- one requested, these functions impact the part
696         -- defined by the parameter with a value greater than U,
697         -- i.e. the part of the curve to the "right" of the singularity.
698         --   Raises UndefinedDerivative if the continuity of the curve is not C3.
699     
700   DN (me; U : Real; N : Integer)  returns Vec2d
701         --- Purpose: For the point of parameter U of this BSpline curve,
702         -- computes the vector corresponding to the Nth derivative.
703         -- Warning
704         -- On a point where the continuity of the curve is not the
705         -- one requested, this function impacts the part defined
706         -- by the parameter with a value greater than U, i.e. the
707         -- part of the curve to the "right" of the singularity.
708         --    Raises  UndefinedDerivative if the continuity of the curve is not CN.
709         --   RangeError if N < 1.
710      raises  UndefinedDerivative,
711                   RangeError;
712
713         --- Purpose: The following functions computes the point of parameter U 
714         --  and the derivatives at this point on the B-spline curve 
715         --  arc defined between the knot FromK1 and the knot ToK2. 
716         --  U can be out of bounds [Knot (FromK1),  Knot (ToK2)] but
717         --  for the computation we only use the definition of the curve
718         --  between these two knots. This method is useful to compute 
719         --  local derivative, if the order of continuity of the whole 
720         --  curve is not greater enough.    Inside the parametric
721         --  domain Knot (FromK1), Knot (ToK2) the evaluations are
722         --  the same as if we consider the whole definition of the
723         --  curve. Of course the evaluations are different outside
724         --  this parametric domain.
725
726
727   LocalValue (me; U : Real; FromK1, ToK2 : Integer)   returns Pnt2d
728      raises DomainError,
729         --- Purpose : Raised if FromK1 = ToK2.
730             OutOfRange;
731         --- Purpose :
732         --  Raised if FromK1 and ToK2 are not in the range 
733         --  [FirstUKnotIndex, LastUKnotIndex].
734
735
736   LocalD0 (me; U : Real; FromK1, ToK2 : Integer; 
737            P : out Pnt2d)
738      raises UndefinedDerivative, OutOfRange;
739      
740      
741   LocalD1 (me; U : Real; FromK1, ToK2 : Integer; 
742            P : out Pnt2d; V1 : out Vec2d)
743      raises UndefinedDerivative,
744         --- Purpose :
745         --  Raised if the local continuity of the curve is not C1 
746         --  between the knot K1 and the knot K2. 
747             DomainError,
748         --- Purpose : Raised if FromK1 = ToK2.
749             OutOfRange;
750         --- Purpose :
751         --  Raised if FromK1 and ToK2 are not in the range 
752         --  [FirstUKnotIndex, LastUKnotIndex].
753
754
755   LocalD2 (me; U : Real; FromK1, ToK2 : Integer;
756            P : out Pnt2d; V1, V2 : out Vec2d)
757      raises UndefinedDerivative,
758         --- Purpose :
759         --  Raised if the local continuity of the curve is not C2 
760         --  between the knot K1 and the knot K2. 
761             DomainError,
762         --- Purpose : Raised if FromK1 = ToK2.
763             OutOfRange;
764         --- Purpose :
765         --  Raised if FromK1 and ToK2 are not in the range 
766         --  [FirstUKnotIndex, LastUKnotIndex].
767
768
769
770   LocalD3 (me; U : Real;  FromK1, ToK2 : Integer;
771            P : out Pnt2d; V1, V2, V3 : out Vec2d)
772      raises UndefinedDerivative,
773         --- Purpose :
774         --  Raised if the local continuity of the curve is not C3
775         --  between the knot K1 and the knot K2. 
776             DomainError,
777         --- Purpose : Raised if FromK1 = ToK2.
778             OutOfRange;
779         --- Purpose :
780         --  Raised if FromK1 and ToK2 are not in the range
781         --  [FirstUKnotIndex, LastUKnotIndex].
782
783
784   LocalDN (me; U : Real;  FromK1, ToK2 : Integer; N : Integer)  returns Vec2d
785      raises  UndefinedDerivative,
786         --- Purpose :
787         --  Raised if the local continuity of the curve is not CN
788         --  between the knot K1 and the knot K2. 
789             DomainError,
790         --- Purpose : Raised if FromK1 = ToK2.
791              RangeError,
792         --- Purpose : Raised if N < 1.
793              OutOfRange;
794         --- Purpose :
795         --  Raises if FromK1 and ToK2 are not in the range 
796         --  [FirstUKnotIndex, LastUKnotIndex].
797
798
799   EndPoint (me)   returns Pnt2d;
800         --- Purpose :
801         --  Returns the last point of the curve.
802         -- Warnings :
803         --  The last point of the curve is different from the last 
804         --  pole of the curve if the multiplicity of the last knot
805         --  is lower than Degree.
806
807
808   FirstUKnotIndex (me)   returns Integer;
809         --- Purpose :
810         --  For a B-spline curve the first parameter (which gives the start
811         --  point of the curve) is a knot value but if the multiplicity of
812         --  the first knot index is lower than Degree + 1 it is not the 
813         --  first knot of the curve. This method computes the index of the
814         --  knot corresponding to the first parameter.
815
816
817   FirstParameter (me)   returns Real;
818         --- Purpose :
819         --  Computes the parametric value of the start point of the curve.
820         --  It is a knot value.
821
822
823   Knot (me; Index : Integer)   returns Real
824         --- Purpose :
825         --  Returns the knot of range Index. When there is a knot 
826         --  with a multiplicity greater than 1 the knot is not repeated.
827         --  The method Multiplicity can be used to get the multiplicity 
828         --  of the Knot.
829      raises OutOfRange;
830         --- Purpose : Raised if Index < 1 or Index > NbKnots
831
832
833   Knots (me; K : out Array1OfReal from TColStd)
834         --- Purpose : returns the knot values of the B-spline curve;
835      raises DimensionError;
836         --- Purpose :
837         --  Raised if the length of K is not equal to the number of knots.
838
839
840   KnotSequence (me; K : out Array1OfReal from TColStd)
841         --- Purpose : Returns the knots sequence.
842         --  In this sequence the knots with a multiplicity greater than 1
843         --  are repeated. 
844         -- Example :
845         --  K = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
846      raises DimensionError;
847         --- Purpose :
848         --  Raised if the length of K is not equal to NbPoles + Degree + 1
849
850
851
852   KnotDistribution (me) returns BSplKnotDistribution from GeomAbs;
853         --- Purpose :
854         --  Returns NonUniform or Uniform or QuasiUniform or PiecewiseBezier.
855         --  If all the knots differ by a positive constant from the 
856         --  preceding knot the BSpline Curve can be :
857         --  - Uniform if all the knots are of multiplicity 1,
858         --  - QuasiUniform if all the knots are of multiplicity 1 except for
859         --    the first and last knot which are of multiplicity Degree + 1,
860         --  - PiecewiseBezier if the first and last knots have multiplicity
861         --    Degree + 1 and if interior knots have multiplicity Degree
862         --    A piecewise Bezier with only two knots is a BezierCurve. 
863         --  else the curve is non uniform.
864         --  The tolerance criterion is Epsilon from class Real.
865
866
867   LastUKnotIndex (me)  returns Integer;
868         --- Purpose :
869         --  For a BSpline curve the last parameter (which gives the 
870         --  end point of the curve) is a knot value but if the 
871         --  multiplicity of the last knot index is lower than 
872         --  Degree + 1 it is not the last knot of the curve. This
873         --  method computes the index of the knot corresponding to
874         --  the last parameter.
875
876
877   LastParameter (me)   returns Real;
878         --- Purpose :
879         --  Computes the parametric value of the end point of the curve.
880         --  It is a knot value.
881
882
883   LocateU (me;
884            U                   : Real; 
885            ParametricTolerance : Real; 
886            I1, I2              : in out Integer;
887            WithKnotRepetition  : Boolean = Standard_False);
888         --- Purpose :
889         --  Locates the parametric value U in the sequence of knots.
890         --  If "WithKnotRepetition" is True we consider the knot's
891         --  representation with repetition of multiple knot value,
892         --  otherwise  we consider the knot's representation with
893         --  no repetition of multiple knot values.
894         --  Knots (I1) <= U <= Knots (I2)
895         --  . if I1 = I2  U is a knot value (the tolerance criterion 
896         --    ParametricTolerance is used).
897         --  . if I1 < 1  => U < Knots (1) - Abs(ParametricTolerance)
898         --  . if I2 > NbKnots => U > Knots (NbKnots) + Abs(ParametricTolerance)
899
900
901   Multiplicity (me; Index : Integer)   returns Integer
902         --- Purpose :
903         --  Returns the multiplicity of the knots of range Index.
904      raises OutOfRange;
905         --- Purpose : Raised if Index < 1 or Index > NbKnots
906
907
908   Multiplicities (me; M : out Array1OfInteger from TColStd)
909         --- Purpose :
910         --  Returns the multiplicity of the knots of the curve.
911      raises DimensionError;
912         --- Purpose :
913         --  Raised if the length of M is not equal to NbKnots.
914
915
916   NbKnots (me)  returns Integer;
917         --- Purpose :
918         --  Returns the number of knots. This method returns the number of 
919         --  knot without repetition of multiple knots.
920
921
922   NbPoles (me)  returns Integer;
923         --- Purpose : Returns the number of poles
924
925
926   Pole (me; Index : Integer)   returns Pnt2d
927         --- Purpose : Returns the pole of range Index.
928      raises OutOfRange;
929         --- Purpose : Raised if Index < 1 or Index > NbPoles.
930
931
932   Poles (me; P : out Array1OfPnt2d)
933         --- Purpose : Returns the poles of the B-spline curve;
934      raises DimensionError;
935         --- Purpose : 
936         --  Raised if the length of P is not equal to the number of poles.
937
938
939   StartPoint (me)  returns Pnt2d;
940         --- Purpose :
941         --  Returns the start point of the curve.
942         -- Warnings :
943         --  This point is different from the first pole of the curve if the
944         --  multiplicity of the first knot is lower than Degree.
945
946
947   Weight (me; Index : Integer)  returns Real  
948         --- Purpose : Returns the weight of the pole of range Index .
949      raises OutOfRange;
950         --- Purpose : Raised if Index < 1 or Index > NbPoles.
951
952
953   Weights (me; W : out Array1OfReal from TColStd)
954         --- Purpose : Returns the weights of the B-spline curve;
955      raises DimensionError;
956         --- Purpose :
957         --  Raised if the length of W is not equal to NbPoles.
958
959
960
961
962
963
964   Transform (me : mutable; T : Trsf2d);
965 ---Purpose: Applies the transformation T to this BSpline curve.
966
967   MaxDegree (myclass)  returns Integer;
968         --- Purpose :
969         --  Returns the value of the maximum degree of the normalized 
970         --  B-spline basis functions in this package.
971
972
973   Resolution(me          : mutable; 
974              ToleranceUV : Real;
975              UTolerance  : out Real); 
976         ---Purpose:  Computes for this BSpline curve the parametric
977         -- tolerance UTolerance for a given tolerance
978         -- Tolerance3D (relative to dimensions in the plane).
979         -- If f(t) is the equation of this BSpline curve,
980         -- UTolerance ensures that:
981         --           | t1 - t0| < Utolerance ===> 
982         --           |f(t1) - f(t0)| < ToleranceUV
983
984
985   Copy (me)  returns like me;
986         ---Purpose: Creates a new object which is a copy of this BSpline curve.  
987     
988   UpdateKnots(me : mutable)
989         ---Purpose: Recompute  the  flatknots,  the knotsdistribution, the continuity.
990   is static private;
991   
992   InvalidateCache(me : mutable)
993         ---Purpose : Invalidates the cache. This has to be private this has to be private
994       is static private;
995
996   
997   ValidateCache(me : mutable ; Parameter : Real) 
998   
999     is static private;
1000         ---Purpose : updates the cache and validates it
1001              
1002 fields
1003
1004   rational  : Boolean;
1005   periodic  : Boolean;
1006   knotSet   : BSplKnotDistribution from GeomAbs; 
1007   smooth    : Shape from GeomAbs;
1008   deg       : Integer;
1009   poles     : HArray1OfPnt2d from TColgp;
1010   weights   : HArray1OfReal from TColStd;
1011   flatknots : HArray1OfReal from TColStd;
1012   knots     : HArray1OfReal from TColStd;
1013   mults     : HArray1OfInteger from TColStd;
1014   cachepoles      : HArray1OfPnt2d     from TColgp;
1015   -- Taylor expansion of the poles function, in homogeneous
1016   -- form if the curve is rational. The taylor expansion
1017   -- is normalized so that the span corresponds to
1018   -- [0 1] see below
1019   cacheweights    : HArray1OfReal    from TColStd;
1020   -- Taylor expansion of the poles function, in homogeneous
1021   -- form if the curve is rational. The taylor expansion
1022   -- is normalized so that the span corresponds to
1023   -- [0 1] see below
1024   validcache      : Integer;
1025   -- = 1 the cache is valid 
1026   -- = 0 the cache is invalid
1027   parametercache    : Real;
1028   -- Parameter at which the Taylor expension is stored in 
1029   -- the cache
1030   spanlenghtcache   : Real;
1031   -- Since the Taylor expansion is normalized in the 
1032   -- cache to evaluate the cache one has to use
1033   -- (Parameter - refcache) * normcache 
1034   spanindexcache : Integer;
1035   -- the span for which the cache is valid if 
1036   -- validcache is 1 
1037
1038   -- usefull to evaluate the parametric resolution
1039   maxderivinv   : Real from Standard;
1040   maxderivinvok : Boolean from Standard;
1041
1042   myMutex       : Mutex from Standard;
1043   -- protected bspline-cache
1044
1045 end;