b311480e |
1 | -- Created on: 1991-08-26 |
2 | -- Created by: JCV |
3 | -- Copyright (c) 1991-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | package BSplSLib |
18 | |
19 | --- Purpose : BSplSLib B-spline surface Library |
20 | -- This package provides an implementation of geometric |
21 | -- functions for rational and non rational, periodic and non |
22 | -- periodic B-spline surface computation. |
23 | -- |
24 | -- this package uses the multi-dimensions splines methods |
25 | -- provided in the package BSplCLib. |
26 | -- |
27 | -- In this package the B-spline surface is defined with : |
28 | -- . its control points : Array2OfPnt Poles |
29 | -- . its weights : Array2OfReal Weights |
30 | -- . its knots and their multiplicity in the two parametric |
31 | -- direction U and V : Array1OfReal UKnots, VKnots and |
32 | -- Array1OfInteger UMults, VMults. |
33 | -- . the degree of the normalized Spline functions : |
34 | -- UDegree, VDegree |
35 | -- |
36 | -- . the Booleans URational, VRational to know if the weights |
37 | -- are constant in the U or V direction. |
38 | -- |
39 | -- . the Booleans UPeriodic, VRational to know if the the |
40 | -- surface is periodic in the U or V direction. |
41 | -- |
42 | -- Warnings : The bounds of UKnots and UMults should be the |
43 | -- same, the bounds of VKnots and VMults should be the same, |
44 | -- the bounds of Poles and Weights shoud be the same. |
45 | -- |
46 | -- The Control points representation is : |
47 | -- Poles(Uorigin,Vorigin) ...................Poles(Uorigin,Vend) |
48 | -- . . |
49 | -- . . |
50 | -- Poles(Uend, Vorigin) .....................Poles(Uend, Vend) |
51 | -- |
52 | -- For the double array the row indice corresponds to the |
53 | -- parametric U direction and the columns indice corresponds |
54 | -- to the parametric V direction. |
55 | -- |
56 | -- KeyWords : |
57 | -- B-spline surface, Functions, Library |
58 | -- |
59 | -- References : |
60 | -- . A survey of curve and surface methods in CADG Wolfgang BOHM |
61 | -- CAGD 1 (1984) |
62 | -- . On de Boor-like algorithms and blossoming Wolfgang BOEHM |
63 | -- cagd 5 (1988) |
64 | -- . Blossoming and knot insertion algorithms for B-spline curves |
65 | -- Ronald N. GOLDMAN |
66 | -- . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA |
67 | -- . Curves and Surfaces for Computer Aided Geometric Design, |
68 | -- a practical guide Gerald Farin |
69 | |
70 | uses TColStd, gp, TColgp |
71 | |
72 | |
73 | is |
94f71cad |
74 | |
75 | imported transient class Cache; |
7fd59977 |
76 | |
77 | imported EvaluatorFunction ; |
78 | ---Purpose: |
79 | -- this is a one dimensional function |
80 | -- typedef void (*EvaluatorFunction) ( |
81 | -- Standard_Integer // Derivative Request |
82 | -- Standard_Real * // StartEnd[2][2] |
83 | -- // [0] = U |
84 | -- // [1] = V |
85 | -- // [0] = start |
86 | -- // [1] = end |
87 | -- Standard_Real // UParameter |
88 | -- Standard_Real // VParamerer |
89 | -- Standard_Real & // Result |
90 | -- Standard_Integer &) ;// Error Code |
91 | -- serves to multiply a given vectorial BSpline by a function |
92 | |
93 | ------------------------------------------------------------- |
94 | ------------------------------------------------------------- |
95 | ---------- ----------- |
96 | ---------- Surface Evaluations ----------- |
97 | ---------- ----------- |
98 | ------------------------------------------------------------- |
99 | ------------------------------------------------------------- |
100 | RationalDerivative(UDeg,VDeg : Integer; |
101 | N,M : Integer; |
102 | Ders : in out Real; |
103 | RDers : in out Real; |
104 | All : Boolean = Standard_True); |
105 | |
106 | ---Purpose: Computes the derivatives of a ratio of |
107 | -- two-variables functions x(u,v) / w(u,v) at orders |
108 | -- <N,M>, x(u,v) is a vector in dimension |
109 | -- <3>. |
110 | -- |
111 | -- <Ders> is an array containing the values of the |
112 | -- input derivatives from 0 to Min(<N>,<UDeg>), 0 to |
113 | -- Min(<M>,<VDeg>). For orders higher than |
114 | -- <UDeg,VDeg> the input derivatives are assumed to |
115 | -- be 0. |
116 | -- |
117 | -- The <Ders> is a 2d array and the dimension of the |
118 | -- lines is always (<VDeg>+1) * (<3>+1), even |
119 | -- if <N> is smaller than <Udeg> (the derivatives |
120 | -- higher than <N> are not used). |
121 | -- |
122 | -- Content of <Ders> : |
123 | -- |
124 | -- x(i,j)[k] means : the composant k of x derivated |
125 | -- (i) times in u and (j) times in v. |
126 | -- |
127 | -- ... First line ... |
128 | -- |
129 | -- x[1],x[2],...,x[3],w |
130 | -- x(0,1)[1],...,x(0,1)[3],w(1,0) |
131 | -- ... |
132 | -- x(0,VDeg)[1],...,x(0,VDeg)[3],w(0,VDeg) |
133 | -- |
134 | -- ... Then second line ... |
135 | -- |
136 | -- x(1,0)[1],...,x(1,0)[3],w(1,0) |
137 | -- x(1,1)[1],...,x(1,1)[3],w(1,1) |
138 | -- ... |
139 | -- x(1,VDeg)[1],...,x(1,VDeg)[3],w(1,VDeg) |
140 | -- |
141 | -- ... |
142 | -- |
143 | -- ... Last line ... |
144 | -- |
145 | -- x(UDeg,0)[1],...,x(UDeg,0)[3],w(UDeg,0) |
146 | -- x(UDeg,1)[1],...,x(UDeg,1)[3],w(UDeg,1) |
147 | -- ... |
148 | -- x(Udeg,VDeg)[1],...,x(UDeg,VDeg)[3],w(Udeg,VDeg) |
149 | -- |
150 | -- |
151 | -- |
152 | -- If <All> is false, only the derivative at order |
153 | -- <N,M> is computed. <RDers> is an array of length |
154 | -- 3 which will contain the result : |
155 | -- |
156 | -- x(1)/w , x(2)/w , ... derivated <N> <M> times |
157 | -- |
158 | -- If <All> is true multiples derivatives are |
159 | -- computed. All the derivatives (i,j) with 0 <= i+j |
160 | -- <= Max(N,M) are computed. <RDers> is an array of |
161 | -- length 3 * (<N>+1) * (<M>+1) which will |
162 | -- contains : |
163 | -- |
164 | -- x(1)/w , x(2)/w , ... |
165 | -- x(1)/w , x(2)/w , ... derivated <0,1> times |
166 | -- x(1)/w , x(2)/w , ... derivated <0,2> times |
167 | -- ... |
168 | -- x(1)/w , x(2)/w , ... derivated <0,N> times |
169 | -- |
170 | -- x(1)/w , x(2)/w , ... derivated <1,0> times |
171 | -- x(1)/w , x(2)/w , ... derivated <1,1> times |
172 | -- ... |
173 | -- x(1)/w , x(2)/w , ... derivated <1,N> times |
174 | -- |
175 | -- x(1)/w , x(2)/w , ... derivated <N,0> times |
176 | -- .... |
177 | -- Warning: <RDers> must be dimensionned properly. |
178 | |
179 | |
180 | D0 (U, V : in Real; |
181 | UIndex, VIndex : in Integer; |
182 | Poles : in Array2OfPnt from TColgp; |
183 | Weights : in Array2OfReal from TColStd; |
184 | UKnots, VKnots : in Array1OfReal from TColStd; |
185 | UMults, VMults : in Array1OfInteger from TColStd; |
186 | UDegree, VDegree : in Integer; |
187 | URat,VRat : in Boolean; |
188 | UPer,VPer : in Boolean; |
189 | P : out Pnt from gp); |
190 | |
191 | |
192 | |
193 | D1 (U, V : in Real; |
194 | UIndex, VIndex : in Integer; |
195 | Poles : in Array2OfPnt from TColgp; |
196 | Weights : in Array2OfReal from TColStd; |
197 | UKnots, VKnots : in Array1OfReal from TColStd; |
198 | UMults, VMults : in Array1OfInteger from TColStd; |
199 | Degree, VDegree : in Integer; |
200 | URat,VRat : in Boolean; |
201 | UPer,VPer : in Boolean; |
202 | P : out Pnt from gp; |
203 | Vu, Vv : out Vec from gp); |
204 | |
205 | D2 (U, V : in Real; |
206 | UIndex, VIndex : in Integer; |
207 | Poles : in Array2OfPnt from TColgp; |
208 | Weights : in Array2OfReal from TColStd; |
209 | UKnots, VKnots : in Array1OfReal from TColStd; |
210 | UMults, VMults : in Array1OfInteger from TColStd; |
211 | UDegree, VDegree : in Integer; |
212 | URat,VRat : in Boolean; |
213 | UPer,VPer : in Boolean; |
214 | P : out Pnt from gp; |
215 | Vu, Vv : out Vec from gp; |
216 | Vuu, Vvv, Vuv : out Vec from gp); |
217 | |
218 | D3 (U, V : in Real; |
219 | UIndex, VIndex : in Integer; |
220 | Poles : in Array2OfPnt from TColgp; |
221 | Weights : in Array2OfReal from TColStd; |
222 | UKnots, VKnots : in Array1OfReal from TColStd; |
223 | UMults, VMults : in Array1OfInteger from TColStd; |
224 | UDegree, VDegree : in Integer; |
225 | URat,VRat : in Boolean; |
226 | UPer,VPer : in Boolean; |
227 | P : out Pnt from gp; |
228 | Vu, Vv : out Vec from gp; |
229 | Vuu, Vvv, Vuv : out Vec from gp; |
230 | Vuuu, Vvvv, Vuuv, Vuvv : out Vec from gp); |
231 | |
232 | DN (U, V : in Real; |
233 | Nu, Nv : in Integer; |
234 | UIndex, VIndex : in Integer; |
235 | Poles : in Array2OfPnt from TColgp; |
236 | Weights : in Array2OfReal from TColStd; |
237 | UKnots, VKnots : in Array1OfReal from TColStd; |
238 | UMults, VMults : in Array1OfInteger from TColStd; |
239 | UDegree, VDegree : in Integer; |
240 | URat,VRat : in Boolean; |
241 | UPer,VPer : in Boolean; |
242 | Vn : out Vec from gp); |
243 | |
244 | |
245 | |
246 | Iso (Param : in Real; |
247 | IsU : in Boolean; |
248 | Poles : in Array2OfPnt from TColgp; |
249 | Weights : in Array2OfReal from TColStd; |
250 | Knots : in Array1OfReal from TColStd; |
251 | Mults : in Array1OfInteger from TColStd; |
252 | Degree : in Integer; |
253 | Periodic : in Boolean; |
254 | CPoles : out Array1OfPnt from TColgp; |
255 | CWeights : out Array1OfReal from TColStd); |
256 | |
257 | ---Purpose: Computes the poles and weights of an isoparametric |
258 | -- curve at parameter <Param> (UIso if <IsU> is True, |
259 | -- VIso else). |
260 | |
261 | |
262 | Reverse (Poles : in out Array2OfPnt from TColgp; |
263 | Last : Integer from Standard; |
264 | UDirection : Boolean from Standard); |
265 | ---Purpose: Reverses the array of poles. Last is the Index of |
266 | -- the new first Row( Col) of Poles. |
267 | -- On a non periodic surface Last is |
268 | -- Poles.Upper(). |
269 | -- On a periodic curve last is |
270 | -- (number of flat knots - degree - 1) |
271 | -- or |
272 | -- (sum of multiplicities(but for the last) + degree |
273 | -- - 1) |
274 | |
275 | |
276 | |
277 | HomogeneousD0 (U, V : in Real; |
278 | UIndex, VIndex : in Integer; |
279 | Poles : in Array2OfPnt from TColgp; |
280 | Weights : in Array2OfReal from TColStd; |
281 | UKnots, VKnots : in Array1OfReal from TColStd; |
282 | UMults, VMults : in Array1OfInteger from TColStd; |
283 | UDegree, VDegree : in Integer; |
284 | URat,VRat : in Boolean; |
285 | UPer,VPer : in Boolean; |
286 | W : out Real ; |
287 | P : out Pnt from gp); |
288 | |
289 | ---Purpose: Makes an homogeneous evaluation of Poles and Weights |
290 | -- any and returns in P the Numerator value and |
291 | -- in W the Denominator value if Weights are present |
292 | -- otherwise returns 1.0e0 |
293 | -- |
294 | HomogeneousD1 (U, V : in Real; |
295 | UIndex, VIndex : in Integer; |
296 | Poles : in Array2OfPnt from TColgp; |
297 | Weights : in Array2OfReal from TColStd; |
298 | UKnots, VKnots : in Array1OfReal from TColStd; |
299 | UMults, VMults : in Array1OfInteger from TColStd; |
300 | UDegree, VDegree : in Integer; |
301 | URat,VRat : in Boolean; |
302 | UPer,VPer : in Boolean; |
303 | |
304 | N : out Pnt from gp; |
305 | Nu : out Vec from gp; |
306 | Nv : out Vec from gp; |
307 | D : out Real ; |
308 | Du : out Real ; |
309 | Dv : out Real) ; |
310 | |
311 | ---Purpose: Makes an homogeneous evaluation of Poles and Weights |
312 | -- any and returns in P the Numerator value and |
313 | -- in W the Denominator value if Weights are present |
314 | -- otherwise returns 1.0e0 |
315 | -- |
316 | Reverse (Weights : in out Array2OfReal from TColStd; |
317 | Last : Integer from Standard; |
318 | UDirection : Boolean from Standard); |
319 | ---Purpose: Reverses the array of weights. |
320 | |
321 | IsRational(Weights : Array2OfReal from TColStd; |
322 | I1,I2 : Integer from Standard; |
323 | J1,J2 : Integer from Standard; |
324 | Epsilon : Real = 0.0) returns Boolean; |
325 | ---Purpose: |
326 | -- Returns False if all the weights of the array <Weights> |
327 | -- in the area [I1,I2] * [J1,J2] are identic. |
328 | -- Epsilon is used for comparing weights. |
329 | -- If Epsilon is 0. the Epsilon of the first weight is used. |
330 | |
331 | |
332 | SetPoles(Poles : Array2OfPnt from TColgp; |
333 | FP : out Array1OfReal from TColStd; |
334 | UDirection : Boolean from Standard); |
335 | ---Purpose: Copy in FP the coordinates of the poles. |
336 | |
337 | SetPoles(Poles : Array2OfPnt from TColgp; |
338 | Weights : Array2OfReal from TColStd; |
339 | FP : out Array1OfReal from TColStd; |
340 | UDirection : Boolean from Standard); |
341 | ---Purpose: Copy in FP the coordinates of the poles. |
342 | |
343 | GetPoles(FP : Array1OfReal from TColStd; |
344 | Poles : out Array2OfPnt from TColgp; |
345 | UDirection : Boolean from Standard); |
346 | ---Purpose: Get from FP the coordinates of the poles. |
347 | |
348 | GetPoles(FP : Array1OfReal from TColStd; |
349 | Poles : out Array2OfPnt from TColgp; |
350 | Weights : out Array2OfReal from TColStd; |
351 | UDirection : Boolean from Standard); |
352 | ---Purpose: Get from FP the coordinates of the poles. |
353 | |
354 | MovePoint(U, V : Real; -- parameters of the point |
355 | Displ : Vec from gp; -- translation vector of the point |
356 | UIndex1 : Integer; -- first movable pole in U |
357 | UIndex2 : Integer; -- last movable pole in U |
358 | VIndex1 : Integer; -- first movable pole in V |
359 | VIndex2 : Integer; -- last movable pole in V |
360 | UDegree : Integer; |
361 | VDegree : Integer; |
362 | Rational : Boolean; |
363 | Poles : Array2OfPnt from TColgp; |
364 | Weights : Array2OfReal from TColStd; |
365 | UFlatKnots : Array1OfReal from TColStd; |
366 | VFlatKnots : Array1OfReal from TColStd; |
367 | UFirstIndex : in out Integer; -- first pole modified in U |
368 | ULastIndex : in out Integer; -- last pole modified in U |
369 | VFirstIndex : in out Integer; -- first pole modified in V |
370 | VLastIndex : in out Integer; -- last pole modified in V |
371 | NewPoles : in out Array2OfPnt from TColgp); -- new poles |
372 | ---Purpose: Find the new poles which allows an old point (with a |
373 | -- given u,v as parameters) to reach a new position |
374 | -- UIndex1,UIndex2 indicate the range of poles we can |
375 | -- move for U |
376 | -- (1, UNbPoles-1) or (2, UNbPoles) -> no constraint |
377 | -- for one side in U |
378 | -- (2, UNbPoles-1) -> the ends are enforced for U |
379 | -- don't enter (1,NbPoles) and (1,VNbPoles) |
380 | -- -> error: rigid move |
381 | -- if problem in BSplineBasis calculation, no change |
382 | -- for the curve and |
383 | -- UFirstIndex, VLastIndex = 0 |
384 | -- VFirstIndex, VLastIndex = 0 |
385 | |
386 | |
387 | InsertKnots(UDirection : in Boolean from Standard; |
388 | Degree : in Integer from Standard; |
389 | Periodic : in Boolean from Standard; |
390 | Poles : in Array2OfPnt from TColgp; |
391 | Weights : in Array2OfReal from TColStd; |
392 | Knots : in Array1OfReal from TColStd; |
393 | Mults : in Array1OfInteger from TColStd; |
394 | AddKnots : in Array1OfReal from TColStd; |
395 | AddMults : in Array1OfInteger from TColStd; |
396 | NewPoles : out Array2OfPnt from TColgp; |
397 | NewWeights : out Array2OfReal from TColStd; |
398 | NewKnots : out Array1OfReal from TColStd; |
399 | NewMults : out Array1OfInteger from TColStd; |
400 | Epsilon : in Real from Standard; |
401 | Add : in Boolean from Standard = Standard_True); |
402 | |
403 | RemoveKnot(UDirection : in Boolean from Standard; |
404 | Index : in Integer from Standard; |
405 | Mult : in Integer from Standard; |
406 | Degree : in Integer from Standard; |
407 | Periodic : in Boolean from Standard; |
408 | Poles : in Array2OfPnt from TColgp; |
409 | Weights : in Array2OfReal from TColStd; |
410 | Knots : in Array1OfReal from TColStd; |
411 | Mults : in Array1OfInteger from TColStd; |
412 | NewPoles : out Array2OfPnt from TColgp; |
413 | NewWeights : out Array2OfReal from TColStd; |
414 | NewKnots : out Array1OfReal from TColStd; |
415 | NewMults : out Array1OfInteger from TColStd; |
416 | Tolerance : in Real from Standard) |
417 | returns Boolean from Standard; |
418 | |
419 | IncreaseDegree(UDirection : in Boolean from Standard; |
420 | Degree : in Integer from Standard; |
421 | NewDegree : in Integer from Standard; |
422 | Periodic : in Boolean from Standard; |
423 | Poles : in Array2OfPnt from TColgp; |
424 | Weights : in Array2OfReal from TColStd; |
425 | Knots : in Array1OfReal from TColStd; |
426 | Mults : in Array1OfInteger from TColStd; |
427 | NewPoles : out Array2OfPnt from TColgp; |
428 | NewWeights : out Array2OfReal from TColStd; |
429 | NewKnots : out Array1OfReal from TColStd; |
430 | NewMults : out Array1OfInteger from TColStd); |
431 | |
432 | |
433 | Unperiodize(UDirection : in Boolean from Standard; |
434 | Degree : in Integer from Standard; |
435 | Mults : in Array1OfInteger from TColStd; |
436 | Knots : in Array1OfReal from TColStd; |
437 | Poles : in Array2OfPnt from TColgp; |
438 | Weights : in Array2OfReal from TColStd; |
439 | NewMults : out Array1OfInteger from TColStd; |
440 | NewKnots : out Array1OfReal from TColStd; |
441 | NewPoles : out Array2OfPnt from TColgp; |
442 | NewWeights : out Array2OfReal from TColStd); |
443 | |
444 | |
445 | NoWeights returns Array2OfReal from TColStd; |
446 | ---Purpose: Used as argument for a non rational curve. |
447 | -- |
448 | ---C++: return & |
449 | ---C++: inline |
450 | |
451 | |
452 | BuildCache(U,V : Real; |
453 | USpanDomain,VSpanDomain : Real; |
454 | UPeriodicFlag,VPeriodicFlag : Boolean ; |
455 | UDegree,VDegree : Integer; |
456 | UIndex, VIndex : Integer; |
457 | UFlatKnots,VFlatKnots : Array1OfReal from TColStd ; |
458 | Poles : Array2OfPnt from TColgp; |
459 | Weights : Array2OfReal from TColStd ; |
460 | CachePoles : in out Array2OfPnt from TColgp; |
461 | CacheWeights : in out Array2OfReal from TColStd); |
462 | |
463 | ---Purpose: Perform the evaluation of the Taylor expansion |
464 | -- of the Bspline normalized between 0 and 1. |
465 | -- If rational computes the homogeneous Taylor expension |
466 | -- for the numerator and stores it in CachePoles |
467 | -- |
468 | -- |
469 | |
94f71cad |
470 | BuildCache(theU, theV : Real; |
471 | theUSpanDomain, theVSpanDomain : Real; |
472 | theUPeriodic, theVPeriodic : Boolean; |
473 | theUDegree, theVDegree : Integer; |
474 | theUIndex, theVIndex : Integer; |
475 | theUFlatKnots, theVFlatKnots : Array1OfReal from TColStd; |
476 | thePoles : Array2OfPnt from TColgp; |
477 | theWeights : Array2OfReal from TColStd; |
478 | theCacheArray : in out Array2OfReal from TColStd); |
479 | ---Purpose: Perform the evaluation of the Taylor expansion |
480 | -- of the Bspline normalized between 0 and 1. |
481 | -- Structure of result optimized for BSplSLib_Cache. |
482 | |
7fd59977 |
483 | CacheD0(U,V : Real; |
484 | UDegree,VDegree : Integer; |
485 | UCacheParameter,VCacheParameter : Real; |
486 | USpanLenght,VSpanLength : Real; |
487 | Poles : Array2OfPnt from TColgp ; |
488 | Weights : Array2OfReal from TColStd ; |
489 | Point : out Pnt from gp) ; |
490 | |
491 | ---Purpose: Perform the evaluation of the of the cache |
492 | -- the parameter must be normalized between |
493 | -- the 0 and 1 for the span. |
494 | -- The Cache must be valid when calling this |
495 | -- routine. Geom Package will insure that. |
496 | -- and then multiplies by the weights |
497 | -- this just evaluates the current point |
498 | -- the CacheParameter is where the Cache was |
499 | -- constructed the SpanLength is to normalize |
500 | -- the polynomial in the cache to avoid bad conditioning |
501 | -- effects |
502 | -- |
503 | |
504 | CoefsD0(U,V : Real; |
505 | Poles : Array2OfPnt from TColgp ; |
506 | Weights : Array2OfReal from TColStd ; |
507 | Point : out Pnt from gp) ; |
508 | ---Purpose: Calls CacheD0 for Bezier Surfaces Arrays computed with |
509 | -- the method PolesCoefficients. |
510 | -- Warning: To be used for BezierSurfaces ONLY!!! |
511 | ---C++: inline |
512 | |
513 | |
514 | CacheD1(U,V : Real; |
515 | UDegree,VDegree : Integer; |
516 | UCacheParameter,VCacheParameter : Real; |
517 | USpanLenght,VSpanLength : Real; |
518 | Poles : Array2OfPnt from TColgp ; |
519 | Weights : Array2OfReal from TColStd ; |
520 | Point : out Pnt from gp; |
521 | VecU, VecV : out Vec from gp) ; |
522 | |
523 | ---Purpose: Perform the evaluation of the of the cache |
524 | -- the parameter must be normalized between |
525 | -- the 0 and 1 for the span. |
526 | -- The Cache must be valid when calling this |
527 | -- routine. Geom Package will insure that. |
528 | -- and then multiplies by the weights |
529 | -- this just evaluates the current point |
530 | -- the CacheParameter is where the Cache was |
531 | -- constructed the SpanLength is to normalize |
532 | -- the polynomial in the cache to avoid bad conditioning |
533 | -- effects |
534 | -- |
535 | |
536 | CoefsD1(U,V : Real; |
537 | Poles : Array2OfPnt from TColgp; |
538 | Weights : Array2OfReal from TColStd; |
539 | Point : out Pnt from gp; |
540 | VecU, VecV : out Vec from gp) ; |
541 | ---Purpose: Calls CacheD0 for Bezier Surfaces Arrays computed with |
542 | -- the method PolesCoefficients. |
543 | -- Warning: To be used for BezierSurfaces ONLY!!! |
544 | ---C++: inline |
545 | |
546 | |
547 | CacheD2(U,V : Real; |
548 | UDegree,VDegree : Integer; |
549 | UCacheParameter,VCacheParameter : Real; |
550 | USpanLenght,VSpanLength : Real; |
551 | Poles : Array2OfPnt from TColgp ; |
552 | Weights : Array2OfReal from TColStd ; |
553 | Point : out Pnt from gp; |
554 | VecU, VecV, VecUU, VecUV, VecVV : out Vec from gp) ; |
555 | |
556 | ---Purpose: Perform the evaluation of the of the cache |
557 | -- the parameter must be normalized between |
558 | -- the 0 and 1 for the span. |
559 | -- The Cache must be valid when calling this |
560 | -- routine. Geom Package will insure that. |
561 | -- and then multiplies by the weights |
562 | -- this just evaluates the current point |
563 | -- the CacheParameter is where the Cache was |
564 | -- constructed the SpanLength is to normalize |
565 | -- the polynomial in the cache to avoid bad conditioning |
566 | -- effects |
567 | -- |
568 | |
569 | CoefsD2(U,V : Real; |
570 | Poles : Array2OfPnt from TColgp ; |
571 | Weights : Array2OfReal from TColStd ; |
572 | Point : out Pnt from gp; |
573 | VecU, VecV, VecUU, VecUV, VecVV : out Vec from gp) ; |
574 | ---Purpose: Calls CacheD0 for Bezier Surfaces Arrays computed with |
575 | -- the method PolesCoefficients. |
576 | -- Warning: To be used for BezierSurfaces ONLY!!! |
577 | ---C++: inline |
578 | |
579 | |
580 | PolesCoefficients(Poles : Array2OfPnt from TColgp; |
581 | CachePoles : in out Array2OfPnt from TColgp); |
582 | ---Purpose: Warning! To be used for BezierSurfaces ONLY!!! |
583 | ---C++: inline |
584 | |
585 | PolesCoefficients(Poles : Array2OfPnt from TColgp; |
586 | Weights : Array2OfReal from TColStd ; |
587 | CachePoles : in out Array2OfPnt from TColgp; |
588 | CacheWeights : in out Array2OfReal from TColStd) ; |
589 | |
590 | ---Purpose: Encapsulation of BuildCache to perform the |
591 | -- evaluation of the Taylor expansion for beziersurfaces |
592 | -- at parameters 0.,0.; |
593 | -- Warning: To be used for BezierSurfaces ONLY!!! |
594 | -- |
595 | |
596 | |
597 | Resolution(Poles : in Array2OfPnt from TColgp ; |
598 | Weights : in Array2OfReal from TColStd; |
599 | UKnots, VKnots : in Array1OfReal from TColStd; |
600 | UMults, VMults : in Array1OfInteger from TColStd; |
601 | UDegree, VDegree : in Integer; |
602 | URat,VRat : in Boolean; |
603 | UPer,VPer : in Boolean; |
604 | Tolerance3D : in Real from Standard ; |
605 | UTolerance : in out Real from Standard ; |
606 | VTolerance : in out Real from Standard) ; |
607 | ---Purpose: Given a tolerance in 3D space returns two |
608 | -- tolerances, one in U one in V such that for |
609 | -- all (u1,v1) and (u0,v0) in the domain of |
610 | -- the surface f(u,v) we have : |
611 | -- | u1 - u0 | < UTolerance and |
612 | -- | v1 - v0 | < VTolerance |
613 | -- we have |f (u1,v1) - f (u0,v0)| < Tolerance3D |
614 | Interpolate(UDegree, VDegree : Integer ; |
615 | UFlatKnots , VFlatKnots : Array1OfReal from TColStd ; |
616 | UParameters, VParameters : Array1OfReal from TColStd ; |
617 | Poles : in out Array2OfPnt from TColgp ; |
618 | Weights : in out Array2OfReal from TColStd ; |
619 | InversionProblem : out Integer) ; |
620 | |
621 | ---Purpose: Performs the interpolation of the data points given in |
622 | -- the Poles array in the form |
623 | -- [1,...,RL][1,...,RC][1...PolesDimension] . The |
624 | -- ColLength CL and the Length of UParameters must be the |
625 | -- same. The length of VFlatKnots is VDegree + CL + 1. |
626 | -- |
627 | -- The RowLength RL and the Length of VParameters must be |
628 | -- the same. The length of VFlatKnots is Degree + RL + 1. |
629 | -- |
630 | -- Warning: the method used to do that interpolation |
631 | -- is gauss elimination WITHOUT pivoting. Thus if the |
632 | -- diagonal is not dominant there is no guarantee that |
633 | -- the algorithm will work. Nevertheless for Cubic |
634 | -- interpolation at knots or interpolation at Scheonberg |
635 | -- points the method will work. The InversionProblem |
636 | -- will report 0 if there was no problem else it will |
637 | -- give the index of the faulty pivot |
638 | |
639 | -- |
640 | Interpolate(UDegree, VDegree : Integer ; |
641 | UFlatKnots , VFlatKnots : Array1OfReal from TColStd ; |
642 | UParameters, VParameters : Array1OfReal from TColStd ; |
643 | Poles : in out Array2OfPnt from TColgp ; |
644 | InversionProblem : out Integer) ; |
645 | |
646 | ---Purpose: Performs the interpolation of the data points given in |
647 | -- the Poles array. |
648 | -- The ColLength CL and the Length of UParameters must be |
649 | -- the same. The length of VFlatKnots is VDegree + CL + 1. |
650 | -- |
651 | -- The RowLength RL and the Length of VParameters must be |
652 | -- the same. The length of VFlatKnots is Degree + RL + 1. |
653 | -- |
654 | -- Warning: the method used to do that interpolation |
655 | -- is gauss elimination WITHOUT pivoting. Thus if the |
656 | -- diagonal is not dominant there is no guarantee that |
657 | -- the algorithm will work. Nevertheless for Cubic |
658 | -- interpolation at knots or interpolation at Scheonberg |
659 | -- points the method will work. The InversionProblem |
660 | -- will report 0 if there was no problem else it will |
661 | -- give the index of the faulty pivot |
662 | |
663 | -- |
664 | FunctionMultiply( |
665 | |
666 | Function : EvaluatorFunction from BSplSLib ; |
667 | UBSplineDegree : Integer ; |
668 | VBSplineDegree : Integer ; |
669 | UBSplineKnots : Array1OfReal from TColStd ; |
670 | VBSplineKnots : Array1OfReal from TColStd ; |
671 | UMults : Array1OfInteger from TColStd ; |
672 | VMults : Array1OfInteger from TColStd ; |
673 | Poles : Array2OfPnt from TColgp ; |
674 | Weights : Array2OfReal from TColStd ; |
675 | UFlatKnots : Array1OfReal from TColStd ; |
676 | VFlatKnots : Array1OfReal from TColStd ; |
677 | UNewDegree : Integer ; |
678 | VNewDegree : Integer ; |
679 | NewNumerator : in out Array2OfPnt from TColgp ; |
680 | NewDenominator : in out Array2OfReal from TColStd ; |
681 | Status : in out Integer) ; |
682 | |
683 | ---Purpose: this will multiply a given BSpline numerator N(u,v) |
684 | -- and denominator D(u,v) defined by its |
685 | -- U/VBSplineDegree and U/VBSplineKnots, and |
686 | -- U/VMults. Its Poles and Weights are arrays which are |
687 | -- coded as array2 of the form |
688 | -- [1..UNumPoles][1..VNumPoles] by a function a(u,v) |
689 | -- which is assumed to satisfy the following : 1. |
690 | -- a(u,v) * N(u,v) and a(u,v) * D(u,v) is a polynomial |
691 | -- BSpline that can be expressed exactly as a BSpline of |
692 | -- degree U/VNewDegree on the knots U/VFlatKnots 2. the range |
693 | -- of a(u,v) is the same as the range of N(u,v) |
694 | -- or D(u,v) |
695 | -- ---Warning: it is the caller's responsability to |
696 | -- insure that conditions 1. and 2. above are satisfied |
697 | -- : no check whatsoever is made in this method -- |
698 | -- Status will return 0 if OK else it will return the |
699 | -- pivot index -- of the matrix that was inverted to |
700 | -- compute the multiplied -- BSpline : the method used |
701 | -- is interpolation at Schoenenberg -- points of |
702 | -- a(u,v)* N(u,v) and a(u,v) * D(u,v) |
703 | -- Status will return 0 if OK else it will return the pivot index |
704 | -- of the matrix that was inverted to compute the multiplied |
705 | -- BSpline : the method used is interpolation at Schoenenberg |
706 | -- points of a(u,v)*F(u,v) |
707 | -- -- |
708 | -- |
709 | end BSplSLib; |
710 | |
711 | |
712 | |
713 | |
714 | |