102802f366cc76f1ba92c292ba0b74d3ec29eb55
[occt.git] / src / Geom / Geom_BSplineSurface.cdl
1 -- Created on: 1993-03-09
2 -- Created by: JCV
3 -- Copyright (c) 1993-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
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.
10 --
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.
13 --
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.
20
21
22
23 class BSplineSurface from Geom inherits BoundedSurface from Geom
24
25         ---Purpose : Describes a BSpline surface.
26         -- In each parametric direction, a BSpline surface can be:
27         -- - uniform or non-uniform,
28         -- - rational or non-rational,
29         -- - periodic or non-periodic.
30         -- A BSpline surface is defined by:
31         -- - its degrees, in the u and v parametric directions,
32         -- - its periodic characteristic, in the u and v parametric directions,
33         -- - a table of poles, also called control points (together
34         --   with the associated weights if the surface is rational), and
35         -- - a table of knots, together with the associated multiplicities.
36         --   The degree of a Geom_BSplineSurface is limited to
37         -- a value (25) which is defined and controlled by the
38         -- system. This value is returned by the function MaxDegree.
39         --       Poles and Weights
40         -- Poles and Weights are manipulated using two associative double arrays:
41         -- - the poles table, which is a double array of gp_Pnt points, and
42         -- - the weights table, which is a double array of reals.
43         -- The bounds of the poles and weights arrays are:
44         -- - 1 and NbUPoles for the row bounds (provided
45         --   that the BSpline surface is not periodic in the u
46         --   parametric direction), where NbUPoles is the
47         --   number of poles of the surface in the u parametric direction, and
48         -- - 1 and NbVPoles for the column bounds (provided
49         --   that the BSpline surface is not periodic in the v
50         --   parametric direction), where NbVPoles is the
51         --   number of poles of the surface in the v parametric direction.
52         --   The poles of the surface are the points used to shape
53         -- and reshape the surface. They comprise a rectangular network.
54         -- If the surface is not periodic:
55         -- - The points (1, 1), (NbUPoles, 1), (1,
56         --   NbVPoles), and (NbUPoles, NbVPoles)
57         --   are the four parametric "corners" of the surface.
58         -- - The first column of poles and the last column of
59         --   poles define two BSpline curves which delimit the
60         --   surface in the v parametric direction. These are the
61         --   v isoparametric curves corresponding to the two
62         --   bounds of the v parameter.
63         -- - The first row of poles and the last row of poles
64         --   define two BSpline curves which delimit the surface
65         --   in the u parametric direction. These are the u
66         --   isoparametric curves corresponding to the two bounds of the u parameter.
67         -- If the surface is periodic, these geometric properties are not verified.
68         -- It is more difficult to define a geometrical significance
69         -- for the weights. However they are useful for
70         -- representing a quadric surface precisely. Moreover, if
71         -- the weights of all the poles are equal, the surface has
72         -- a polynomial equation, and hence is a "non-rational surface".
73         -- The non-rational surface is a special, but frequently
74         -- used, case, where all poles have identical weights.
75         -- The weights are defined and used only in the case of
76         -- a rational surface. The rational characteristic is
77         -- defined in each parametric direction. A surface can be
78         -- rational in the u parametric direction, and
79         -- non-rational in the v parametric direction.
80         --        Knots and Multiplicities
81         -- For a Geom_BSplineSurface the table of knots is
82         -- made up of two increasing sequences of reals, without
83         -- repetition, one for each parametric direction. The
84         -- multiplicities define the repetition of the knots.
85         -- A BSpline surface comprises multiple contiguous
86         -- patches, which are themselves polynomial or rational
87         -- surfaces. The knots are the parameters of the
88         -- isoparametric curves which limit these contiguous
89         -- patches. The multiplicity of a knot on a BSpline
90         -- surface (in a given parametric direction) is related to
91         -- the degree of continuity of the surface at that knot in
92         -- that parametric direction:
93         -- Degree of continuity at knot(i) = Degree - Multi(i) where:
94         -- - Degree is the degree of the BSpline surface in
95         --   the given parametric direction, and
96         -- - Multi(i) is the multiplicity of knot number i in
97         --   the given parametric direction.
98         -- There are some special cases, where the knots are
99         -- regularly spaced in one parametric direction (i.e. the
100         -- difference between two consecutive knots is a constant).
101         -- - "Uniform": all the multiplicities are equal to 1.
102         -- - "Quasi-uniform": all the multiplicities are equal to 1,
103         --   except for the first and last knots in this parametric
104         --   direction, and these are equal to Degree + 1.
105         -- - "Piecewise Bezier": all the multiplicities are equal to
106         --   Degree except for the first and last knots, which
107         --   are equal to Degree + 1. This surface is a
108         --   concatenation of Bezier patches in the given
109         --   parametric direction.
110         -- If the BSpline surface is not periodic in a given
111         -- parametric direction, the bounds of the knots and
112         -- multiplicities tables are 1 and NbKnots, where
113         -- NbKnots is the number of knots of the BSpline
114         -- surface in that parametric direction.
115         -- If the BSpline surface is periodic in a given parametric
116         -- direction, and there are k periodic knots and p
117         -- periodic poles in that parametric direction:
118         -- - the period is such that:
119         -- period = Knot(k+1) - Knot(1), and
120         -- - the poles and knots tables in that parametric
121         --   direction can be considered as infinite tables, such that:
122         -- Knot(i+k) = Knot(i) + period, and
123         -- Pole(i+p) = Pole(i)
124         -- Note: The data structure tables for a periodic BSpline
125         -- surface are more complex than those of a non-periodic one.
126         -- References :
127         --  . A survey of curve and surface methods in CADG Wolfgang BOHM
128         --    CAGD 1 (1984)
129         --  . On de Boor-like algorithms and blossoming Wolfgang BOEHM
130         --    cagd 5 (1988)
131         --  . Blossoming and knot insertion algorithms for B-spline curves
132         --    Ronald N. GOLDMAN
133         --  . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA   
134         --  . Curves and Surfaces for Computer Aided Geometric Design,
135         --    a practical guide Gerald Farin
136
137
138
139 uses  Array1OfInteger      from TColStd,
140       Array1OfReal         from TColStd,
141       Array2OfReal         from TColStd, 
142       HArray1OfInteger     from TColStd,
143       HArray1OfReal        from TColStd,
144       HArray2OfReal        from TColStd,
145       Array1OfPnt          from TColgp, 
146       Array2OfPnt          from TColgp,
147       Ax1                  from gp, 
148       Ax2                  from gp,
149       HArray2OfPnt         from TColgp, 
150       Pnt                  from gp,
151       Trsf                 from gp,
152       Vec                  from gp, 
153       BSplKnotDistribution from GeomAbs,
154       Curve                from Geom,
155       Geometry             from Geom,
156       Shape                from GeomAbs,
157       Mutex                from Standard
158
159 raises ConstructionError   from Standard,
160        DimensionError      from Standard,
161        DomainError         from Standard,
162        OutOfRange          from Standard,
163        NoSuchObject        from Standard,
164        RangeError          from Standard,
165        UndefinedDerivative from Geom
166
167
168
169 is
170       
171
172
173   Create (Poles                        : Array2OfPnt     from TColgp; 
174           UKnots, VKnots               : Array1OfReal    from TColStd; 
175           UMults, VMults               : Array1OfInteger from TColStd; 
176           UDegree, VDegree             : Integer;
177           UPeriodic                    : Boolean = Standard_False;
178           VPeriodic                    : Boolean = Standard_False)
179      returns mutable BSplineSurface
180      
181         ---Purpose : Creates  a non-rational b-spline surface (weights
182         --         default value is 1.).
183      raises ConstructionError;
184         ---Purpose: The following conditions must be verified.
185         --   0 < UDegree <= MaxDegree.
186         --   UKnots.Length() == UMults.Length() >= 2
187         --   UKnots(i) < UKnots(i+1) (Knots are increasing)
188         --   1 <= UMults(i) <= UDegree
189         --   On a   non  uperiodic   surface    the  first and    last 
190         --   umultiplicities  may  be     UDegree+1  (this   is   even
191         --   recommanded if you want the curve  to start and finish on
192         --   the first and last pole).
193         --   On a uperiodic     surface  the first    and   the   last
194         --   umultiplicities must be the same.
195         --   on non-uperiodic surfaces
196         --     Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2
197         --   on uperiodic surfaces 
198         --   Poles.ColLength() == Sum(UMults(i)) except the first or last
199         --   The previous conditions for U holds  also for V, with the
200         --   RowLength of the poles.
201
202
203
204
205   Create (Poles                        : Array2OfPnt     from TColgp; 
206           Weights                      : Array2OfReal    from TColStd;
207           UKnots, VKnots               : Array1OfReal    from TColStd; 
208           UMults, VMults               : Array1OfInteger from TColStd; 
209           UDegree, VDegree             : Integer;
210           UPeriodic                    : Boolean = Standard_False;
211           VPeriodic                    : Boolean = Standard_False)
212      returns mutable BSplineSurface
213      
214         ---Purpose : Creates  a non-rational b-spline surface (weights
215         --         default value is 1.).
216         --  
217      raises ConstructionError;
218         ---Purpose: The following conditions must be verified.
219         --  0 < UDegree <= MaxDegree.
220         --  
221         --  UKnots.Length() == UMults.Length() >= 2
222         --  
223         --  UKnots(i) < UKnots(i+1) (Knots are increasing)
224         --  1 <= UMults(i) <= UDegree
225         --  
226         --   On a   non  uperiodic   surface    the  first and    last
227         --   umultiplicities  may  be     UDegree+1  (this   is   even
228         --   recommanded if you want the curve  to start and finish on
229         --   the first and last pole).
230         --   
231         --   On a uperiodic     surface  the first    and   the   last
232         --   umultiplicities must be the same.
233         --   
234         --   on non-uperiodic surfaces
235         --   
236         --     Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2
237         --     
238         --   on uperiodic surfaces 
239         --   
240         --     Poles.ColLength() == Sum(UMults(i)) except the first or
241         --     last
242         --     
243         --   
244         --   The previous conditions for U holds  also for V, with the
245         --   RowLength of the poles.
246
247
248
249   ExchangeUV (me : mutable);
250         ---Purpose: Exchanges the u and v parametric directions on
251         -- this BSpline surface.
252         -- As a consequence:
253         -- - the poles and weights tables are transposed,
254         -- - the knots and multiplicities tables are exchanged,
255         -- - degrees of continuity, and rational, periodic and
256         --   uniform characteristics are exchanged, and
257         -- - the orientation of the surface is inverted.
258
259   SetUPeriodic (me : mutable);
260         ---Purpose: Sets the surface U periodic.
261
262   SetVPeriodic (me : mutable);
263         ---Purpose:  Modifies this surface to be periodic in the u (or v)
264         -- parametric direction.
265         -- To become periodic in a given parametric direction a
266         -- surface must be closed in that parametric direction,
267         -- and the knot sequence relative to that direction must be periodic.
268         -- To generate this periodic sequence of knots, the
269         -- functions FirstUKnotIndex and LastUKnotIndex (or
270         -- FirstVKnotIndex and LastVKnotIndex) are used to
271         -- compute I1 and I2. These are the indexes, in the
272         -- knot array associated with the given parametric
273         -- direction, of the knots that correspond to the first and
274         -- last parameters of this BSpline surface in the given
275         -- parametric direction. Hence the period is:
276         -- Knots(I1) - Knots(I2)
277         -- As a result, the knots and poles tables are modified.
278         -- Exceptions
279         -- Standard_ConstructionError if the surface is not
280         -- closed in the given parametric direction.
281                  
282               
283              
284         
285   PeriodicNormalization(me ;  U,V : in out Real) ; 
286        
287         ---Purpose : returns the parameter normalized within
288         --         the period if the surface is periodic : otherwise
289         --         does not do anything
290
291   SetUOrigin (me : mutable; Index : Integer)
292         ---Purpose: Assigns the knot of index Index in the knots table in
293         -- the corresponding parametric direction to be the
294         -- origin of this periodic BSpline surface. As a
295         -- consequence, the knots and poles tables are modified.
296         -- Exceptions
297         -- Standard_NoSuchObject if this BSpline surface is
298         -- not periodic in the given parametric direction.
299         -- Standard_DomainError if Index is outside the
300         -- bounds of the knots table in the given parametric direction.
301     raises NoSuchObject,
302            DomainError;
303         
304   SetVOrigin (me : mutable; Index : Integer)
305         ---Purpose: Assigns the knot of index Index in the knots table in
306         -- the corresponding parametric direction to be the
307         -- origin of this periodic BSpline surface. As a
308         -- consequence, the knots and poles tables are modified.
309         -- Exceptions
310         -- Standard_NoSuchObject if this BSpline surface is
311         -- not periodic in the given parametric direction.
312         -- Standard_DomainError if Index is outside the
313         -- bounds of the knots table in the given parametric direction.
314     raises NoSuchObject,
315            DomainError;
316         
317
318   SetUNotPeriodic (me : mutable);
319
320   SetVNotPeriodic (me : mutable);
321         ---Purpose: Modifies this surface to be periodic in the u (or v) parametric direction.
322         -- To become periodic in a given parametric direction a
323         -- surface must be closed in that parametric direction,
324         -- and the knot sequence relative to that direction must be periodic.
325         -- To generate this periodic sequence of knots, the
326         -- functions FirstUKnotIndex and LastUKnotIndex (or
327         -- FirstVKnotIndex and LastVKnotIndex) are used to
328         -- compute I1 and I2. These are the indexes, in the
329         -- knot array associated with the given parametric
330         -- direction, of the knots that correspond to the first and
331         -- last parameters of this BSpline surface in the given
332         -- parametric direction. Hence the period is:
333         -- Knots(I1) - Knots(I2)
334         -- As a result, the knots and poles tables are modified.
335         -- Exceptions
336         -- Standard_ConstructionError if the surface is not
337         -- closed in the given parametric direction.
338
339   UReverse (me : mutable);
340     
341   VReverse (me : mutable);
342         ---Purpose: Changes the orientation of this BSpline surface in the
343         -- u (or v) parametric direction. The bounds of the
344         -- surface are not changed but the given parametric
345         -- direction is reversed. Hence the orientation of the
346         -- surface is reversed.
347         -- The knots and poles tables are modified.
348     
349   UReversedParameter (me; U : Real) returns Real;
350   
351   VReversedParameter (me; V : Real) returns Real;
352         ---Purpose: Computes the u (or v) parameter on the modified
353         -- surface, produced by reversing its u (or v) parametric
354         -- direction, for the point of u parameter U, (or of v
355         -- parameter V) on this BSpline surface.
356         -- For a BSpline surface, these functions return respectively:
357         -- - UFirst + ULast - U, or
358         -- - VFirst + VLast - V,
359         -- where UFirst, ULast, VFirst and VLast are
360         -- the values of the first and last parameters of this
361         -- BSpline surface, in the u and v parametric directions.
362
363
364   IncreaseDegree (me : mutable; UDegree, VDegree : Integer);
365         ---Purpose : Increases the degrees of this BSpline surface to
366         -- UDegree and VDegree in the u and v parametric
367         -- directions respectively. As a result, the tables of poles,
368         -- weights and multiplicities are modified. The tables of
369         -- knots is not changed.
370         -- Note: Nothing is done if the given degree is less than
371         -- or equal to the current degree in the corresponding
372         -- parametric direction.
373         -- Exceptions
374         -- Standard_ConstructionError if UDegree or
375         -- VDegree is greater than
376         -- Geom_BSplineSurface::MaxDegree().
377
378
379   InsertUKnots (me : mutable; Knots : Array1OfReal    from TColStd; 
380                               Mults : Array1OfInteger from TColStd;
381                               ParametricTolerance : Real = 0.0;
382                               Add : Boolean = Standard_True);
383                              
384   InsertVKnots (me : mutable; Knots : Array1OfReal    from TColStd; 
385                               Mults : Array1OfInteger from TColStd;
386                               ParametricTolerance : Real = 0.0;
387                               Add : Boolean = Standard_True);
388                              
389         ---Purpose: Inserts into the knots table for the corresponding
390         -- parametric direction of this BSpline surface:
391         -- - the value U, or V, with the multiplicity M (defaulted to 1), or
392         -- - the values of the array Knots, with their respective
393         -- multiplicities, Mults.
394         -- If the knot value to insert already exists in the table, its multiplicity is:
395         -- - increased by M, if Add is true (the default), or
396         -- - increased to M, if Add is false.
397         -- The tolerance criterion used to check the equality of
398         -- the knots is the larger of the values ParametricTolerance and
399         -- Standard_Real::Epsilon(val), where val is the knot value to be inserted.
400         -- Warning
401         -- - If a given multiplicity coefficient is null, or negative, nothing is done.
402         -- - The new multiplicity of a knot is limited to the degree of this BSpline surface in the
403         --   corresponding parametric direction.
404         -- Exceptions
405         -- Standard_ConstructionError if a knot value to
406         -- insert is outside the bounds of this BSpline surface in
407         -- the specified parametric direction. The comparison
408         -- uses the precision criterion ParametricTolerance.
409    
410      
411   RemoveUKnot(me : mutable; Index     : Integer; 
412                            M         : Integer;
413                            Tolerance : Real) returns Boolean
414   raises OutOfRange;
415                            
416   RemoveVKnot(me : mutable; Index     : Integer; 
417                            M         : Integer;
418                            Tolerance : Real) returns Boolean
419   raises OutOfRange;
420                            
421         ---Purpose : Reduces to M the multiplicity of the knot of index
422         -- Index in the given parametric direction. If M is 0, the knot is removed.
423         -- With a modification of this type, the table of poles is also modified.
424         -- Two different algorithms are used systematically to
425         -- compute the new poles of the surface. For each
426         -- pole, the distance between the pole calculated
427         -- using the first algorithm and the same pole
428         -- calculated using the second algorithm, is checked. If
429         -- this distance is less than Tolerance it ensures that
430         -- the surface is not modified by more than Tolerance.
431         -- Under these conditions, the function returns true;
432         -- otherwise, it returns false.
433         -- A low tolerance prevents modification of the
434         -- surface. A high tolerance "smoothes" the surface.
435         -- Exceptions
436         -- Standard_OutOfRange if Index is outside the
437         -- bounds of the knots table of this BSpline surface.         
438
439      
440   IncreaseUMultiplicity (me : mutable; UIndex : Integer; M : Integer)
441         ---Purpose :
442         --  Increases the multiplicity of the knot of range UIndex 
443         --  in the UKnots sequence.
444         --  M is the new multiplicity. M must be greater than the
445         --  previous multiplicity and lower or equal to the degree
446         --  of the surface in the U parametric direction.
447      raises ConstructionError,
448         ---Purpose : Raised if M is not in the range [1, UDegree]
449             OutOfRange;
450         ---Purpose : 
451         --  Raised if UIndex is not in the range [FirstUKnotIndex,
452         --  LastUKnotIndex] given by the methods with the same name.
453
454
455   IncreaseUMultiplicity (me : mutable; FromI1, ToI2 : Integer; M : Integer)
456         ---Purpose :
457         --  Increases until order M the multiplicity of the set of knots
458         --  FromI1,...., ToI2 in the U direction. This method can be used 
459         --  to make a B_spline surface into a PiecewiseBezier B_spline
460         --  surface.
461         --  If <me> was uniform, it can become non uniform.
462      raises OutOfRange,
463         ---Purpose :
464         --  Raised if FromI1 or ToI2 is out of the range [FirstUKnotIndex,
465         --  LastUKnotIndex].
466             ConstructionError;
467         ---Purpose : 
468         --  M should be greater than the previous multiplicity of the 
469         --  all the knots FromI1,..., ToI2 and lower or equal to the
470         --   Degree of the surface in the U parametric direction.
471
472
473   IncrementUMultiplicity (me : mutable; FromI1, ToI2 : Integer; Step : Integer)
474         ---Purpose :
475         --  Increments the multiplicity of the consecutives uknots FromI1..ToI2
476         --  by step.   The multiplicity of each knot FromI1,.....,ToI2 must be
477         --  lower or equal to the UDegree of the B_spline.
478      raises OutOfRange,
479         ---Purpose :
480         --  Raised if FromI1 or ToI2 is not in the range
481         --  [FirstUKnotIndex, LastUKnotIndex] 
482             ConstructionError;
483        ---Purpose :
484         --  Raised if one knot has a multiplicity greater than UDegree.
485
486
487   IncreaseVMultiplicity (me : mutable; VIndex : Integer; M : Integer)
488         ---Purpose :
489         --  Increases the multiplicity of a knot in the V direction.
490         --  M is the new multiplicity.
491      raises ConstructionError,
492         ---Purpose :
493         --  M should be greater than the previous multiplicity and lower 
494         --  than the degree of the surface in the V parametric direction.
495             OutOfRange;
496         ---Purpose :
497         --  Raised if VIndex is not in the range [FirstVKnotIndex, 
498         --  LastVKnotIndex] given by the methods with the same name.
499
500
501   IncreaseVMultiplicity (me : mutable; FromI1, ToI2 : Integer; M : Integer)
502         ---Purpose :
503         --  Increases until order M the multiplicity of the set of knots
504         --  FromI1,...., ToI2 in the V direction. This method can be used to
505         --  make a BSplineSurface into a PiecewiseBezier B_spline
506         --  surface. If <me> was uniform, it can become non-uniform.
507      raises OutOfRange,
508         ---Purpose :
509         --  Raised if FromI1 or ToI2 is out of the range [FirstVKnotIndex,
510         --  LastVKnotIndex] given by the methods with the same name.
511             ConstructionError;
512         ---Purpose : 
513         --  M should be greater than the previous multiplicity of the
514         --  all the knots FromI1,..., ToI2 and lower or equal to the
515         --  Degree of the surface in the V parametric direction.
516
517
518   IncrementVMultiplicity (me : mutable; FromI1, ToI2 : Integer; Step : Integer)
519         ---Purpose :
520         --  Increments the multiplicity of the consecutives vknots FromI1..ToI2
521         --  by step.  The multiplicity of each knot FromI1,.....,ToI2 must be
522         --  lower or equal to the VDegree of the B_spline.
523      raises OutOfRange,
524         ---Purpose :
525         --  Raised if FromI1 or ToI2 is not in the range
526         --  [FirstVKnotIndex, LastVKnotIndex] 
527             ConstructionError;
528         ---Purpose :
529         --  Raised if one knot has a multiplicity greater than VDegree.
530
531
532   InsertUKnot (me : mutable; U : Real; M : Integer; ParametricTolerance : Real;
533                              Add : Boolean = Standard_True)
534         ---Purpose:
535         --  Inserts a knot value in the sequence of UKnots. If U is a knot
536         --  value this method increases the multiplicity of the knot if the
537         --  previous multiplicity was lower than M else it does nothing. The
538         --  tolerance criterion is ParametricTolerance. ParametricTolerance
539         --  should be greater or equal than Resolution from package gp.
540      raises ConstructionError;
541         ---Purpose :
542         --  Raised if U is out of the bounds [U1, U2] given by the methods 
543         --  Bounds, the criterion ParametricTolerance is used.
544         --  Raised if M is not in the range [1, UDegree].
545
546
547   InsertVKnot (me : mutable; V : Real; M : Integer; ParametricTolerance : Real;
548                              Add : Boolean = Standard_True)
549         ---Purpose :
550         --  Inserts a knot value in the sequence of VKnots. If V is a knot
551         --  value this method increases the multiplicity of the knot if the
552         --  previous multiplicity was lower than M otherwise it does nothing.
553         --  The tolerance criterion is ParametricTolerance.
554         --  ParametricTolerance should be greater or equal than Resolution
555         --  from package gp.
556      raises ConstructionError;
557         ---Purpose :
558         --  raises if V is out of the Bounds [V1, V2] given by the methods 
559         --  Bounds, the criterion ParametricTolerance is used.
560         --  raises if M is not in the range [1, VDegree].
561
562
563   Segment (me : mutable; U1, U2, V1, V2 : Real)
564         ---Purpose :
565         --  Segments the surface between U1 and U2 in the U-Direction.
566         --                       between V1 and V2 in the V-Direction.
567         --  The control points are modified, the first and the last point
568         --  are not the same.
569         -- Warnings :
570         --  Even if <me> is not closed it can become closed after the 
571         --  segmentation for example if U1 or U2 are out of the bounds 
572         --  of the surface <me> or if the surface makes loop.
573     raises DomainError from Standard;
574         ---Purpose: raises if U2 < U1 or V2 < V1
575
576
577   CheckAndSegment (me : mutable; U1, U2, V1, V2 : Real)
578         ---Purpose :
579         --  Segments the surface between U1 and U2 in the U-Direction.
580         --                       between V1 and V2 in the V-Direction.
581         --                       
582         --  same as Segment but do nothing if U1 and U2 (resp. V1 and V2) are
583         --  equal to the bounds in U (resp. in V) of <me>. 
584         --  For example, if <me> is periodic in V, it will be always periodic
585         --  in V after the segmentation if the bounds in V are unchanged
586         --  
587         -- Warnings : 
588         --  Even if <me> is not closed it can become closed after the 
589         --  segmentation for example if U1 or U2 are out of the bounds 
590         --  of the surface <me> or if the surface makes loop.
591     raises DomainError from Standard;
592         ---Purpose: raises if U2 < U1 or V2 < V1
593
594
595   SetUKnot (me : mutable; UIndex : Integer; K : Real)
596         ---Purpose :  Substitutes the UKnots of range UIndex with K.
597      raises OutOfRange,
598         ---Purpose :
599         --  Raised if UIndex < 1 or UIndex > NbUKnots
600             ConstructionError;
601         ---Purpose :
602         --  Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1)
603
604
605   SetUKnots (me : mutable; UK : Array1OfReal from TColStd)
606         ---Purpose :  Changes all the U-knots of the surface.
607         --  The multiplicity of the knots are not modified.
608      raises ConstructionError,
609         ---Purpose : 
610         --  Raised if there is an index such that UK (Index+1) <= UK (Index).
611             OutOfRange;
612         ---Purpose : 
613         --  Raised if  UK.Lower() < 1 or UK.Upper() > NbUKnots
614
615
616   SetUKnot (me : mutable; UIndex : Integer; K : Real; M : Integer)
617         ---Purpose :  
618         --  Changes the value of the UKnots of range UIndex and 
619         --  increases its multiplicity.
620      raises OutOfRange,
621         ---Purpose :
622         --  Raised if UIndex is not in the range [FirstUKnotIndex,
623         --  LastUKnotIndex] given by the methods with the same name.
624             ConstructionError;
625         ---Purpose :
626         --  Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1)
627         --  M must be lower than UDegree and greater than the previous 
628         --  multiplicity of the knot of range UIndex.
629
630
631   SetVKnot (me : mutable; VIndex : Integer; K : Real)
632         ---Purpose :  Substitutes the VKnots of range VIndex with K.
633      raises OutOfRange,
634         ---Purpose :
635         --  Raised if VIndex < 1 or VIndex > NbVKnots
636             ConstructionError;
637         ---Purpose :
638         --  Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1)
639
640
641   SetVKnots (me : mutable; VK : Array1OfReal from TColStd)
642         ---Purpose :  Changes all the V-knots of the surface.
643         --  The multiplicity of the knots are not modified.
644      raises ConstructionError,
645         ---Purpose : 
646         --  Raised if there is an index such that VK (Index+1) <= VK (Index).
647             OutOfRange;
648         ---Purpose : 
649         --  Raised if  VK.Lower() < 1 or VK.Upper() > NbVKnots
650
651
652
653   SetVKnot (me : mutable; VIndex : Integer; K : Real; M : Integer)
654         ---Purpose :  
655         --  Changes the value of the VKnots of range VIndex and increases 
656         --  its multiplicity.
657      raises OutOfRange,
658         ---Purpose :
659         --  Raised if VIndex is not in the range [FirstVKnotIndex,
660         --  LastVKnotIndex] given by the methods with the same name.
661             ConstructionError;
662         ---Purpose :
663         --  Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1)
664         --  M must be lower than VDegree and greater than the previous 
665         --  multiplicity of the knot of range VIndex.
666
667
668   LocateU (me;
669            U                   : Real; 
670            ParametricTolerance : Real;
671            I1, I2              : in out Integer;
672            WithKnotRepetition  : Boolean = Standard_False);
673         ---Purpose :
674         --  Locates the parametric value U in the sequence of UKnots.
675         --  If "WithKnotRepetition" is True we consider the knot's
676         --  representation with repetition of multiple knot value,
677         --  otherwise  we consider the knot's representation with
678         --  no repetition of multiple knot values.
679         --  UKnots (I1) <= U <= UKnots (I2)
680         --  . if I1 = I2  U is a knot value (the tolerance criterion 
681         --    ParametricTolerance is used).
682         --  . if I1 < 1  => U < UKnots(1) - Abs(ParametricTolerance)
683         --  . if I2 > NbUKnots => U > UKnots(NbUKnots)+Abs(ParametricTolerance)
684
685
686   LocateV (me; 
687            V                   : Real; 
688            ParametricTolerance : Real;
689            I1, I2              : in out Integer;
690            WithKnotRepetition  : Boolean = Standard_False);
691         ---Purpose :
692         --  Locates the parametric value U in the sequence of knots.
693         --  If "WithKnotRepetition" is True we consider the knot's
694         --  representation with repetition of multiple knot value,
695         --  otherwise  we consider the knot's representation with
696         --  no repetition of multiple knot values.
697         --  VKnots (I1) <= V <= VKnots (I2)
698         --  . if I1 = I2  V is a knot value (the tolerance criterion 
699         --    ParametricTolerance is used).
700         --  . if I1 < 1  => V < VKnots(1) - Abs(ParametricTolerance)
701         --  . if I2 > NbVKnots => V > VKnots(NbVKnots)+Abs(ParametricTolerance)
702
703
704
705
706
707
708
709         ---Purpose :  poles insertion and removing
710         --  The following methods are available only if the surface
711         --  is Uniform or QuasiUniform in the considered direction
712         --  The knot repartition is modified.
713
714
715
716
717         ----Purpose : poles and weights modifications
718
719   SetPole (me : mutable; UIndex, VIndex : Integer; P : Pnt)
720         ---Purpose :
721         --  Substitutes the pole of range (UIndex, VIndex) with P.
722         --  If the surface is rational the weight of range (UIndex, VIndex)
723         --  is not modified.
724      raises OutOfRange;
725         ---Purpose :
726         --  Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
727         --  VIndex > NbVPoles.
728
729
730   SetPole (me : mutable; UIndex, VIndex : Integer; P : Pnt; Weight : Real)
731         ---Purpose :
732         --  Substitutes the pole and the weight of range (UIndex, VIndex)
733         --  with P and W.
734      raises OutOfRange,
735         ---Purpose :
736         --  Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
737         --  VIndex > NbVPoles.
738             ConstructionError;
739         ---Purpose : Raised if Weight <= Resolution from package gp.
740
741
742   SetPoleCol (me : mutable; VIndex : Integer; CPoles : Array1OfPnt from TColgp)
743          ---Purpose :
744          --  Changes a column of poles or a part of this column.
745      raises OutOfRange,
746         ---Purpose : Raised if Vindex < 1 or VIndex > NbVPoles.
747             ConstructionError;
748         ---Purpose :
749         --  Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles.
750
751
752   SetPoleCol (me : mutable; VIndex : Integer; CPoles : Array1OfPnt from TColgp;
753               CPoleWeights : Array1OfReal from TColStd)
754          ---Purpose :
755          --  Changes a column of poles or a part of this column with the
756          --  corresponding weights. If the surface was rational it can
757          --  become non rational. If the surface was non rational it can
758          --  become rational.
759      raises OutOfRange,
760         ---Purpose : Raised if Vindex < 1 or VIndex > NbVPoles.
761             ConstructionError;
762         ---Purpose :
763         --  Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles
764         --  Raised if the bounds of CPoleWeights are not the same as the
765         --  bounds of CPoles.
766         --  Raised if one of the weight value of CPoleWeights is lower or
767         --  equal to Resolution from package gp.
768
769
770   SetPoleRow (me : mutable; UIndex : Integer; CPoles : Array1OfPnt from TColgp;
771               CPoleWeights : Array1OfReal from TColStd)
772          ---Purpose :
773          --  Changes a row of poles or a part of this row with the
774          --  corresponding weights. If the surface was rational it can
775          --  become non rational. If the surface was non rational it can
776          --  become rational.
777      raises OutOfRange,
778         ---Purpose : Raised if Uindex < 1 or UIndex > NbUPoles.
779             ConstructionError;
780         ---Purpose :
781         --  Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles
782         --  raises if the bounds of CPoleWeights are not the same as the
783         --  bounds of CPoles.
784         --  Raised if one of the weight value of CPoleWeights is lower or
785         --  equal to Resolution from package gp.
786
787
788   SetPoleRow (me : mutable; UIndex : Integer; CPoles : Array1OfPnt from TColgp)
789          ---Purpose :
790          --  Changes a row of poles or a part of this row.
791      raises OutOfRange,
792         ---Purpose : Raised if Uindex < 1 or UIndex > NbUPoles.
793             ConstructionError;
794         ---Purpose :
795         --  Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles.
796
797
798   SetWeight (me : mutable; UIndex, VIndex : Integer; Weight : Real)
799         ---Purpose :
800         --  Changes the weight of the pole of range UIndex, VIndex.
801         --  If the surface was non rational it can become rational.
802         --  If the surface was rational it can become non rational.
803      raises OutOfRange,
804         ---Purpose : 
805         --  Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
806         --  VIndex > NbVPoles
807             ConstructionError;
808         ---Purpose : 
809         --  Raised if weight is lower or equal to Resolution from 
810         --  package gp
811
812
813   SetWeightCol (me : mutable; VIndex : Integer;
814                 CPoleWeights : Array1OfReal from TColStd)
815         ---Purpose :
816         --  Changes a column of weights of a part of this column.
817      raises OutOfRange,
818         ---Purpose : 
819         --  Raised if VIndex < 1 or VIndex > NbVPoles
820             ConstructionError;
821         ---Purpose :
822         --  Raised if CPoleWeights.Lower() < 1 or 
823         --            CPoleWeights.Upper() > NbUPoles.
824         --  Raised if a weight value is lower or equal to Resolution
825         --  from package gp.
826
827
828   SetWeightRow (me : mutable; UIndex : Integer;
829                 CPoleWeights : Array1OfReal from TColStd)
830         ---Purpose :  
831         --  Changes a row of weights or a part of this row.
832      raises OutOfRange,
833         ---Purpose : 
834         --  Raised if UIndex < 1 or UIndex > NbUPoles
835             ConstructionError;
836         ---Purpose :
837         --  Raised if CPoleWeights.Lower() < 1 or 
838         --            CPoleWeights.Upper() > NbVPoles.
839         --  Raised  if a weight value is lower or equal to Resolution
840         --  from package gp.
841
842   MovePoint(me: mutable; U, V : Real; P: Pnt;
843             UIndex1, UIndex2, VIndex1, VIndex2: Integer;
844             UFirstIndex, ULastIndex, VFirstIndex, VLastIndex: out Integer)
845       ---Purpose: Move a point with parameter U and V to P.
846       --          given u,v  as parameters)  to  reach a  new position
847       --          UIndex1, UIndex2, VIndex1, VIndex2:
848       --                  indicates the poles which can be moved      
849       --          if Problem in BSplineBasis calculation, no change
850       --          for the curve and
851       --              UFirstIndex, VLastIndex = 0
852       --              VFirstIndex, VLastIndex = 0
853      raises OutOfRange;
854         ---Purpose:
855         --  Raised if UIndex1 < UIndex2 or VIndex1 < VIndex2 or
856         --            UIndex1 < 1 || UIndex1 > NbUPoles or
857         --            UIndex2 < 1 || UIndex2 > NbUPoles
858         --            VIndex1 < 1 || VIndex1 > NbVPoles or
859         --            VIndex2 < 1 || VIndex2 > NbVPoles
860
861
862
863         ---Purpose : characteristics of the surface
864
865   IsUClosed (me)  returns Boolean;
866         ---Purpose :
867         --  Returns true if the first control points row and the last
868         --  control points row are identical. The tolerance criterion
869         --  is Resolution from package gp.
870
871   IsVClosed (me)   returns Boolean;
872         ---Purpose :
873         --  Returns true if the first control points column and the
874         --  last last control points column are identical. 
875         --  The tolerance criterion is Resolution from package gp.
876
877
878   IsCNu (me; N : Integer)  returns Boolean
879         ---Purpose :
880         --  Returns True if the order of continuity of the surface in the 
881         --  U direction  is N.
882      raises RangeError;
883         ---Purpose : Raised if N < 0.
884
885
886   IsCNv (me; N : Integer)   returns Boolean
887         ---Purpose :
888         --  Returns True if the order of continuity of the surface 
889         --  in the V direction  is N.
890      raises RangeError;
891         ---Purpose : Raised if N < 0.
892
893
894   IsUPeriodic (me)  returns Boolean;
895         ---Purpose :
896         --  Returns True if the surface is closed in the U direction
897         --  and if the B-spline has been turned into a periodic surface
898         --  using the function SetUPeriodic.
899
900
901   IsURational (me)   returns Boolean;
902         ---Purpose :
903         --  Returns False if for each row of weights all the weights
904         --  are identical.
905         --  The tolerance criterion is resolution from package gp.
906         --  Example :
907         --                 |1.0, 1.0, 1.0|
908         --   if Weights =  |0.5, 0.5, 0.5|   returns False
909         --                 |2.0, 2.0, 2.0|
910
911
912   IsVPeriodic (me)  returns Boolean;
913         ---Purpose :
914         --  Returns True if the surface is closed in the V direction
915         --  and if the B-spline has been turned into a periodic 
916         --  surface using the function SetVPeriodic.
917
918
919   IsVRational (me)  returns Boolean;
920         ---Purpose :
921         --  Returns False if for each column of weights all the weights 
922         --  are identical.
923         --  The tolerance criterion is resolution from package gp.
924         --- Examples :
925         --                 |1.0, 2.0, 0.5|
926         --   if Weights =  |1.0, 2.0, 0.5|   returns False
927         --                 |1.0, 2.0, 0.5|
928
929   IsCacheValid(me;  UParameter, VParameter : Real) returns Boolean ;
930   
931         ---Purpose :
932         --           Tells whether the Cache is valid for the
933         --           given parameter 
934         -- Warnings : the parameter must be normalized within
935         -- the period if the curve is periodic. Otherwise
936         -- the answer will be false
937         -- 
938         
939   Bounds (me; U1, U2, V1, V2 : out Real);
940         ---Purpose :
941         --  Returns the parametric bounds of the surface.
942         --- Warnings :
943         --  These parametric values are the bounds of the array of
944         --  knots UKnots and VKnots only if the first knots and the
945         --  last knots have a multiplicity equal to UDegree + 1 or
946         --  VDegree + 1
947
948
949   Continuity (me)   returns Shape from GeomAbs;
950         ---Purpose :
951         --  Returns the continuity of the surface : 
952         --  C0 : only geometric continuity,
953         --  C1 : continuity of the first derivative all along the Surface,
954         --  C2 : continuity of the second derivative all along the Surface,
955         --  C3 : continuity of the third derivative all along the Surface,
956         --  CN : the order of continuity is infinite.
957         --  A B-spline surface is infinitely continuously differentiable 
958         --  for the couple of parameters U, V such thats U != UKnots(i) 
959         --  and V != VKnots(i). The continuity of the surface at a knot 
960         --  value depends on the multiplicity of this knot.
961         --- Example :
962         --  If the surface is C1 in the V direction and C2 in the U 
963         --  direction this function returns Shape = C1.
964
965
966   FirstUKnotIndex (me)   returns Integer;
967         ---Purpose :
968         --  Computes the Index of the UKnots which gives the first 
969         --  parametric value of the surface in the U direction.
970         --  The UIso curve corresponding to this value is a 
971         --  boundary curve of the surface.
972
973
974   FirstVKnotIndex (me)   returns Integer;
975         ---Purpose :
976         --  Computes the Index of the VKnots which gives the
977         --  first parametric value of the surface in the V direction.
978         --  The VIso curve corresponding to this knot is a boundary
979         --  curve of the surface.
980      
981      
982   LastUKnotIndex (me)   returns Integer;
983         ---Purpose :
984         --  Computes the Index of the UKnots which gives the 
985         --  last parametric value of the surface in the U direction.
986         --  The UIso curve corresponding to this knot is a boundary 
987         --  curve of the surface.
988      
989      
990   LastVKnotIndex (me)   returns Integer;
991         ---Purpose :
992         --  Computes the Index of the VKnots which gives the 
993         --  last parametric value of the surface in the V direction.
994         --  The VIso curve corresponding to this knot is a
995         --  boundary curve of the surface.
996
997
998   NbUKnots (me)   returns Integer;
999         ---Purpose :  Returns the number of knots in the U direction. 
1000
1001   NbUPoles (me)  returns Integer;
1002         ---Purpose : Returns number of poles in the U direction.
1003
1004   NbVKnots (me)  returns Integer;
1005         ---Purpose : Returns the number of knots in the V direction.
1006
1007   NbVPoles (me)  returns Integer;
1008         ---Purpose : Returns the number of poles in the V direction.
1009
1010
1011   Pole (me; UIndex, VIndex : Integer)   returns Pnt
1012         ---Purpose: 
1013         --  Returns the pole of range (UIndex, VIndex).
1014      raises OutOfRange;
1015         ---Purpose :
1016         --  Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
1017         --  VIndex > NbVPoles.
1018
1019
1020   Poles (me; P : out Array2OfPnt from TColgp)
1021        ---Purpose : Returns the poles of the B-spline surface.
1022      raises DimensionError;
1023        ---Purpose :
1024        --  Raised if the length of P in the U and V direction
1025        --  is not equal to NbUpoles and NbVPoles.
1026
1027
1028   UDegree (me)  returns Integer;
1029         ---Purpose :
1030         --  Returns the degree of the normalized B-splines Ni,n in the U
1031         --  direction.
1032
1033
1034   UKnot (me; UIndex : Integer)  returns Real
1035         ---Purpose :
1036         --  Returns the Knot value of range UIndex.
1037      raises OutOfRange;
1038         ---Purpose : Raised if UIndex < 1 or UIndex > NbUKnots
1039
1040
1041   UKnotDistribution (me)   returns BSplKnotDistribution from GeomAbs;
1042         ---Purpose :
1043         --  Returns NonUniform or Uniform or QuasiUniform or 
1044         --  PiecewiseBezier.  If all the knots differ by a
1045         --  positive constant from the preceding knot in the U 
1046         --  direction the B-spline surface can be :
1047         --  - Uniform if all the knots are of multiplicity 1,
1048         --  - QuasiUniform if all the knots are of multiplicity 1
1049         --    except for the first and last knot which are of 
1050         --    multiplicity Degree + 1,
1051         --  - PiecewiseBezier if the first and last knots have 
1052         --    multiplicity Degree + 1 and if interior knots have
1053         --    multiplicity Degree
1054         --  otherwise the surface is non uniform in the U direction 
1055         --  The tolerance criterion is Resolution from package gp.
1056
1057
1058   UKnots (me; Ku : out Array1OfReal from TColStd)
1059         ---Purpose : Returns the knots in the U direction.
1060      raises DimensionError;
1061         ---Purpose :
1062         --  Raised if the length of Ku is not equal to the number of knots
1063         --  in the U direction.
1064
1065
1066   UKnotSequence (me; Ku : out Array1OfReal from TColStd)
1067         ---Purpose : Returns the uknots sequence.
1068         --  In this sequence the knots with a multiplicity greater than 1
1069         --  are repeated.
1070         --- Example :
1071         --  Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
1072      raises DimensionError;
1073         ---Purpose :
1074         --  Raised if the length of Ku is not equal to NbUPoles + UDegree + 1
1075
1076
1077   UMultiplicity (me; UIndex : Integer)   returns Integer
1078         ---Purpose :
1079         --  Returns the multiplicity value of knot of range UIndex in 
1080         --  the u direction.
1081      raises OutOfRange;
1082         ---Purpose : Raised if UIndex < 1 or UIndex > NbUKnots.
1083
1084
1085   UMultiplicities (me; Mu : out Array1OfInteger from TColStd)
1086         ---Purpose : 
1087         --  Returns the multiplicities of the knots in the U direction.
1088      raises DimensionError;
1089         ---Purpose :
1090         --  Raised if the length of Mu is not equal to the number of
1091         --  knots in the U direction.
1092
1093
1094   VDegree (me)  returns Integer;
1095         ---Purpose : 
1096         --  Returns the degree of the normalized B-splines Ni,d in the 
1097         --  V direction.
1098
1099
1100   VKnot (me; VIndex : Integer)   returns Real
1101         ---Purpose : Returns the Knot value of range VIndex.
1102      raises OutOfRange;
1103         --- Purpse : Raised if VIndex < 1 or VIndex > NbVKnots
1104
1105
1106   VKnotDistribution (me)  returns BSplKnotDistribution from GeomAbs;
1107         ---Purpose :
1108         --  Returns NonUniform or Uniform or QuasiUniform or
1109         --  PiecewiseBezier. If all the knots differ by a positive
1110         --  constant from the preceding knot in the V direction the
1111         --  B-spline surface can be :
1112         --  - Uniform if all the knots are of multiplicity 1,
1113         --  - QuasiUniform if all the knots are of multiplicity 1 
1114         --    except for the first and last knot which are of 
1115         --    multiplicity Degree + 1,
1116         --  - PiecewiseBezier if the first and last knots have
1117         --    multiplicity  Degree + 1 and if interior knots have
1118         --     multiplicity Degree
1119         --  otherwise the surface is non uniform in the V direction.
1120         --  The tolerance criterion is Resolution from package gp.
1121
1122
1123   VKnots (me; Kv : out Array1OfReal from TColStd)
1124        ---Purpose : Returns the knots in the V direction.
1125      raises DimensionError;
1126        ---Purpose :
1127        --  Raised if the length of Kv is not equal to the number of 
1128        --  knots in the V direction.
1129
1130
1131   VKnotSequence (me; Kv : out Array1OfReal from TColStd)
1132         ---Purpose : Returns the vknots sequence.
1133         --  In this sequence the knots with a multiplicity greater than 1
1134         --  are repeated. 
1135         --- Example :
1136         --  Kv = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
1137      raises DimensionError;
1138         ---Purpose :
1139         --  Raised if the length of Kv is not equal to NbVPoles + VDegree + 1
1140
1141
1142   VMultiplicity (me; VIndex : Integer)   returns Integer
1143         ---Purpose :
1144         --  Returns the multiplicity value of knot of range VIndex in 
1145         --  the v direction.
1146      raises OutOfRange;
1147         ---Purpose : Raised if VIndex < 1 or VIndex > NbVKnots
1148
1149   
1150   VMultiplicities (me; Mv : out Array1OfInteger from TColStd)
1151        ---Purpose :
1152        --  Returns the multiplicities of the knots in the V direction.
1153      raises DimensionError;
1154        ---Purpose :
1155        --  Raised if the length of Mv is not equal to the number of 
1156        --  knots in the V direction.
1157
1158
1159   Weight (me; UIndex, VIndex : Integer)   returns Real
1160         ---Purpose : Returns the weight value of range UIndex, VIndex.
1161      raises OutOfRange;
1162         ---Purpose : 
1163         --  Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1
1164         --  or VIndex > NbVPoles.
1165
1166   
1167   Weights (me; W : out Array2OfReal from TColStd)
1168         ---Purpose : Returns the weights of the B-spline surface.
1169      raises DimensionError;
1170         ---Purpose :
1171         --  Raised if the length of W in the U and V direction is 
1172         --  not equal to NbUPoles and NbVPoles.
1173
1174
1175
1176
1177
1178
1179         ---Purpose : value and derivatives computation
1180
1181   D0 (me; U, V : Real; P : out Pnt);
1182
1183
1184   D1 (me; U, V : Real; P : out Pnt; D1U, D1V : out Vec)
1185      raises UndefinedDerivative;
1186         ---Purpose : Raised if the continuity of the surface is not C1.
1187
1188
1189   D2 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec)
1190      raises UndefinedDerivative;
1191         ---Purpose : Raised if the continuity of the surface is not C2.
1192
1193
1194   D3 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV,
1195       D3UVV : out Vec)
1196      raises UndefinedDerivative;
1197         ---Purpose : Raised if the continuity of the surface is not C3.
1198
1199
1200   DN (me; U, V : Real; Nu, Nv : Integer)   returns Vec
1201         ---Purpose :
1202         --  Nu is the order of derivation in the U parametric direction and
1203         --  Nv is the order of derivation in the V parametric direction.
1204      raises UndefinedDerivative,
1205         ---Purpose :
1206         --  Raised if the continuity of the surface is not CNu in the U
1207         --  direction and CNv in the V direction.
1208             RangeError;
1209         ---Purpose :
1210         --  Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
1211
1212
1213
1214
1215
1216
1217         ---Purpose  :
1218         --  The following functions computes the point for the
1219         --  parametric values (U, V) and the derivatives at 
1220         --  this point on the B-spline surface patch delimited
1221         --  with the knots FromUK1, FromVK1 and the knots ToUK2,
1222         --  ToVK2.  (U, V) can be out of these parametric bounds
1223         --  but for the computation we only use the definition
1224         --  of the surface between these knots. This method is 
1225         --  useful to compute local derivative, if the order of
1226         --  continuity of the whole surface is not greater enough.
1227         --  Inside the parametric knot's domain previously defined
1228         --  the evaluations are the same as if we consider the whole
1229         --  definition of the surface. Of course the evaluations are
1230         --  different outside this parametric domain.
1231
1232
1233   LocalD0 (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer;
1234                P : out Pnt)
1235      raises DomainError,
1236         ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1237             OutOfRange;
1238         ---Purpose :
1239         --  Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex,
1240         --  LastUKnotIndex] or if FromVK1, ToVK2 are not in the range
1241         --  [FirstVKnotIndex, LastVKnotIndex]
1242
1243
1244   LocalD1 (me; U, V : Real;  FromUK1, ToUK2, FromVK1, ToVK2 : Integer;
1245           P : out Pnt; D1U, D1V : out Vec)
1246      raises UndefinedDerivative,
1247         ---Purpose :
1248         --  Raised if the local continuity of the surface is not C1 
1249         --  between the knots FromUK1, ToUK2 and FromVK1, ToVK2. 
1250             DomainError,
1251         ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1252             OutOfRange;
1253         ---Purpose :
1254         --  Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex,
1255         --  LastUKnotIndex] or if FromVK1, ToVK2 are not in the range
1256         --  [FirstVKnotIndex, LastVKnotIndex]
1257
1258
1259   LocalD2 (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer;
1260            P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec)
1261      raises UndefinedDerivative,
1262         ---Purpose :
1263         --  Raised if the local continuity of the surface is not C2 
1264         --  between the knots FromUK1, ToUK2 and FromVK1, ToVK2. 
1265             DomainError,
1266         ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1267             OutOfRange;
1268         ---Purpose :
1269         --  Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex,
1270         --  LastUKnotIndex] or if FromVK1, ToVK2 are not in the range
1271         --  [FirstVKnotIndex, LastVKnotIndex]
1272
1273
1274   LocalD3 (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer;
1275            P : out Pnt; D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV :
1276            out Vec)
1277      raises UndefinedDerivative,
1278         ---Purpose :
1279         --  Raised if the local continuity of the surface is not C3
1280         --  between the knots FromUK1, ToUK2 and FromVK1, ToVK2. 
1281             DomainError,
1282         ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1283             OutOfRange;
1284         ---Purpose :
1285         --  Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex,
1286         --  LastUKnotIndex] or if FromVK1, ToVK2 are not in the range
1287         --  [FirstVKnotIndex, LastVKnotIndex]
1288
1289
1290   LocalDN (me; U, V : Real; FromUK1, ToUK2, FromVK1, ToVK2 : Integer; 
1291            Nu, Nv : Integer)
1292      returns Vec
1293      raises UndefinedDerivative,
1294         ---Purpose :
1295         --  Raised if the local continuity of the surface is not CNu 
1296         --  between the knots FromUK1, ToUK2 and CNv between the knots
1297         --  FromVK1, ToVK2. 
1298             DomainError,
1299         ---Purpose : Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1300              RangeError,
1301         --  Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
1302              OutOfRange;
1303         ---Purpose :
1304         --  Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex,
1305         --  LastUKnotIndex] or if FromVK1, ToVK2 are not in the range
1306         --  [FirstVKnotIndex, LastVKnotIndex]
1307
1308   LocalValue(me; U, V : Real;  FromUK1, ToUK2, FromVK1, ToVK2 : Integer)
1309         ---Purpose  :
1310         --  Computes the point of parameter U, V on the BSpline surface patch 
1311         --  defines between the knots UK1 UK2, VK1, VK2. U can be out of the
1312         --  bounds [Knot UK1, Knot UK2] and V can be outof the bounds 
1313         --  [Knot VK1, Knot VK2]  but for the computation we only use the 
1314         --  definition of the surface between these knot values.
1315      returns Pnt
1316      raises DomainError,
1317         ---Purpose : Raises if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1318             OutOfRange;
1319         ---Purpose :
1320         --  Raises if FromUK1, ToUK2 are not in the range [FirstUKnotIndex,
1321         --  LastUKnotIndex] or if FromVK1, ToVK2 are not in the range
1322         --  [FirstVKnotIndex, LastVKnotIndex]
1323
1324
1325
1326   UIso (me; U : Real) returns mutable Curve;
1327         ---Purpose :
1328         --  Computes the U isoparametric curve. 
1329         --  A B-spline curve is returned.
1330
1331
1332   VIso (me; V : Real)  returns mutable Curve;
1333         ---Purpose :
1334         --  Computes the V isoparametric curve. 
1335         --  A B-spline curve is returned.
1336
1337
1338   UIso (me; U : Real; CheckRational : Boolean) returns mutable Curve;
1339         ---Purpose :
1340         --  Computes the U isoparametric curve.  
1341         --  If CheckRational=False, no try to make it non-rational.
1342         --  A B-spline curve is returned.
1343
1344
1345   VIso (me; V : Real; CheckRational : Boolean) returns mutable Curve;
1346         ---Purpose :
1347         --  Computes the V isoparametric curve. 
1348         --  If CheckRational=False, no try to make it non-rational.
1349         --  A B-spline curve is returned.
1350
1351
1352
1353
1354  
1355         ---Purpose : transformations
1356
1357   Transform (me : mutable; T : Trsf) ;
1358
1359         --- Purpose: Applies the transformation T to this BSpline surface.
1360
1361   MaxDegree (myclass)   returns Integer;
1362         ---Purpose :
1363         --  Returns the value of the maximum degree of the normalized 
1364         --  B-spline basis functions in the u and v directions.
1365
1366
1367   Resolution(me          : mutable; 
1368              Tolerance3D :     Real ;
1369              UTolerance  : out Real ;
1370              VTolerance  : out Real) 
1371         ---Purpose: Computes two tolerance values for this BSpline
1372         -- surface, based on the given tolerance in 3D space
1373         -- Tolerance3D. The tolerances computed are:
1374         -- - UTolerance in the u parametric direction, and
1375         -- - VTolerance in the v parametric direction.
1376         -- If f(u,v) is the equation of this BSpline surface,
1377         -- UTolerance and VTolerance guarantee that :
1378         --          | u1 - u0 | < UTolerance and 
1379         --          | v1 - v0 | < VTolerance 
1380         --          ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D
1381   ;
1382   
1383   Copy (me)  returns mutable like me;
1384
1385         ---Purpose: Creates a new object which is a copy of this BSpline surface.
1386
1387   UpdateUKnots(me : mutable)
1388         ---Purpose: Recompute  the  flatknots,  the knotsdistribution, the
1389         --          continuity for U.
1390   is static private;
1391
1392   UpdateVKnots(me : mutable)
1393         ---Purpose: Recompute  the  flatknots,  the knotsdistribution, the
1394         --          continuity for V.
1395   is static private;
1396
1397   
1398   InvalidateCache(me : mutable)
1399         ---Purpose : Invalidates the cache. This has to be private this has to be private
1400       is static private;
1401       
1402   ValidateCache(me : mutable ; UParameter : Real; 
1403                                VParameter : Real) 
1404   
1405     is static private;
1406         ---Purpose : updates the cache and validates it
1407
1408   
1409 fields
1410              
1411    urational : Boolean;
1412    vrational : Boolean;
1413    uperiodic : Boolean;
1414    vperiodic : Boolean;
1415    uknotSet  : BSplKnotDistribution from GeomAbs; 
1416    vknotSet  : BSplKnotDistribution from GeomAbs; 
1417    Usmooth   : Shape from GeomAbs;
1418    Vsmooth   : Shape from GeomAbs;
1419    udeg      : Integer;
1420    vdeg      : Integer;
1421    poles     : HArray2OfPnt     from TColgp;
1422    weights   : HArray2OfReal    from TColStd;
1423    ufknots   : HArray1OfReal    from TColStd;
1424    vfknots   : HArray1OfReal    from TColStd;
1425    uknots    : HArray1OfReal    from TColStd;
1426    vknots    : HArray1OfReal    from TColStd;
1427    umults    : HArray1OfInteger from TColStd;
1428    vmults    : HArray1OfInteger from TColStd;
1429   -- Inplementation of the cache on surfaces
1430    cachepoles : HArray2OfPnt     from TColgp;
1431   -- Taylor expansion of the poles function, in homogeneous
1432   -- form if the curve is rational. The taylor expansion
1433   -- is normalized so that the span corresponds to
1434   -- [0 1]x[0 1]. The Taylor expension of lower degree
1435   -- is stored as consecutive Pnt in the array that is
1436   -- if udeg <= vdeg than the array stores the following
1437   -- 
1438   --                                  (2,0)           (3,0) 
1439   --               (1,0)             f     (u0,v0)   f     (u0,v0)
1440   --  f  (u0,v0)  f     (u0,v0)      -------------   -----------
1441   --                                      2             3!
1442   --                                
1443   --                                   (2,1)           (3,1) 
1444   --   (0,1)          (1,1)         f     (u0,v0)   f     (u0,v0)
1445   --  f     (u0,v0)  f     (u0,v0)  -------------   -----------
1446   --                                     2              3!
1447   --   
1448   -- Otherwise it is stored in the following fashion
1449   -- 
1450   --  
1451   --                                  (0,2)           (0,3) 
1452   --               (0,1)             f     (u0,v0)   f     (u0,v0)
1453   --  f  (u0,v0)  f     (u0,v0)      -------------   -----------
1454   --                                      2             3!
1455   --                                
1456   --                                 (1,2)           (1,3) 
1457   --   (1,0)          (1,1)         f     (u0,v0)   f     (u0,v0)
1458   --  f     (u0,v0)  f     (u0,v0)  -------------   -----------
1459   --                                     2              3!
1460   --   
1461   --   The size of the array is (1,Max degree) (1, Min degree) 
1462   -- 
1463     cacheweights   : HArray2OfReal    from TColStd;
1464   -- Taylor expansion of the poles function, in homogeneous
1465   -- form if the curve is rational. The taylor expansion
1466   -- is normalized so that the span corresponds to
1467   -- [0 1]x[0 1]. The Taylor expension of lower degree
1468   -- is stored as consecutive Real in the array as explained above
1469     ucacheparameter : Real ;
1470     vcacheparameter : Real ;
1471   -- Parameters at which the Taylor expension is stored in 
1472   -- the cache  
1473     ucachespanlenght : Real ;
1474     vcachespanlenght : Real ;
1475       -- Since the Taylor expansion is normalized in the 
1476   -- cache to evaluate the cache one has to use
1477   -- (UParameter - uparametercache) / ucachespanlenght
1478   -- (VParameter - vparametercache) / vcachespanlenght
1479     ucachespanindex : Integer ;
1480     vcachespanindex : Integer ;
1481   -- the span for which the cache is valid if 
1482   -- validcache is 1 
1483     validcache : Integer ;
1484     
1485   -- usefull to evaluate the parametric resolutions
1486     umaxderivinv  : Real from Standard;
1487     vmaxderivinv  : Real from Standard;
1488     maxderivinvok : Boolean from Standard;
1489
1490     myMutex       : Mutex from Standard;
1491     -- protected bsplinesurface-cache
1492
1493 end;