7fd59977 |
1 | // File: GeomFill_BSplineCurves.cxx |
2 | // Created: Wed Oct 6 16:09:19 1993 |
3 | // Author: Bruno DUMORTIER |
4 | // <dub@sdsun1> |
5 | |
6 | #include <GeomFill_BSplineCurves.ixx> |
7 | |
8 | #include <GeomFill_Filling.hxx> |
9 | #include <GeomFill_Stretch.hxx> |
10 | #include <GeomFill_Coons.hxx> |
11 | #include <GeomFill_Curved.hxx> |
12 | |
13 | #include <TColStd_Array1OfReal.hxx> |
14 | #include <TColStd_Array1OfInteger.hxx> |
15 | #include <TColStd_Array2OfReal.hxx> |
16 | #include <TColgp_Array1OfPnt.hxx> |
17 | #include <TColgp_Array2OfPnt.hxx> |
18 | |
19 | #include <Standard_NotImplemented.hxx> |
20 | #include <BSplCLib.hxx> |
21 | #include <Precision.hxx> |
22 | |
23 | |
24 | //======================================================================= |
25 | //function : Arrange |
26 | //purpose : Internal Use Only |
27 | // This function is used to prepare the Filling: The Curves |
28 | // are arranged in this way: |
29 | // |
30 | // CC3 |
31 | // ----->----- |
32 | // | | |
33 | // | | |
34 | // | | |
35 | // CC4 ^ ^ CC2 |
36 | // | | |
37 | // | | |
38 | // ----->----- |
39 | // CC1 = C1 |
40 | //======================================================================= |
41 | |
42 | Standard_Boolean Arrange(const Handle(Geom_BSplineCurve)& C1, |
43 | const Handle(Geom_BSplineCurve)& C2, |
44 | const Handle(Geom_BSplineCurve)& C3, |
45 | const Handle(Geom_BSplineCurve)& C4, |
46 | Handle(Geom_BSplineCurve)& CC1, |
47 | Handle(Geom_BSplineCurve)& CC2, |
48 | Handle(Geom_BSplineCurve)& CC3, |
49 | Handle(Geom_BSplineCurve)& CC4, |
50 | const Standard_Real Tol ) |
51 | { |
52 | Handle(Geom_BSplineCurve) GC[4]; |
53 | Handle(Geom_BSplineCurve) Dummy; |
54 | GC[0] = Handle(Geom_BSplineCurve)::DownCast(C1->Copy()); |
55 | GC[1] = Handle(Geom_BSplineCurve)::DownCast(C2->Copy()); |
56 | GC[2] = Handle(Geom_BSplineCurve)::DownCast(C3->Copy()); |
57 | GC[3] = Handle(Geom_BSplineCurve)::DownCast(C4->Copy()); |
58 | |
59 | Standard_Integer i,j; |
60 | Standard_Boolean Trouve; |
61 | |
62 | for (i=1; i<=3; i++) { |
63 | Trouve = Standard_False; |
64 | for ( j=i; j<=3 && !Trouve; j++) { |
65 | if (GC[j]->StartPoint().Distance( GC[i-1]->EndPoint()) < Tol) { |
66 | Dummy = GC[i]; |
67 | GC[i] = GC[j]; |
68 | GC[j] = Dummy; |
69 | Trouve = Standard_True; |
70 | } |
71 | else if (GC[j]->EndPoint().Distance( GC[i-1]->EndPoint()) < Tol) { |
72 | GC[j] = Handle(Geom_BSplineCurve)::DownCast(GC[j]->Reversed()); |
73 | Dummy = GC[i]; |
74 | GC[i] = GC[j]; |
75 | GC[j] = Dummy; |
76 | Trouve = Standard_True; |
77 | } |
78 | } |
79 | if (!Trouve) return Standard_False; |
80 | } |
81 | |
82 | CC1 = GC[0]; |
83 | CC2 = GC[1]; |
84 | CC3 = Handle(Geom_BSplineCurve)::DownCast( GC[2]->Reversed()); |
85 | CC4 = Handle(Geom_BSplineCurve)::DownCast( GC[3]->Reversed()); |
86 | |
87 | return Standard_True; |
88 | } |
89 | |
90 | |
91 | |
92 | //======================================================================= |
93 | //function : SetSameDistribution |
94 | //purpose : Internal Use Only |
95 | //======================================================================= |
96 | |
97 | Standard_Integer SetSameDistribution(Handle(Geom_BSplineCurve)& C1, |
98 | Handle(Geom_BSplineCurve)& C2 ) |
99 | { |
100 | Standard_Integer nbp1 = C1->NbPoles(); |
101 | Standard_Integer nbk1 = C1->NbKnots(); |
102 | TColgp_Array1OfPnt P1(1,nbp1); |
103 | TColStd_Array1OfReal W1(1,nbp1); |
104 | W1.Init(1.); |
105 | TColStd_Array1OfReal K1(1,nbk1); |
106 | TColStd_Array1OfInteger M1(1,nbk1); |
107 | |
108 | C1->Poles(P1); |
109 | if( C1->IsRational()) |
110 | C1->Weights(W1); |
111 | C1->Knots(K1); |
112 | C1->Multiplicities(M1); |
113 | |
114 | Standard_Integer nbp2 = C2->NbPoles(); |
115 | Standard_Integer nbk2 = C2->NbKnots(); |
116 | TColgp_Array1OfPnt P2(1,nbp2); |
117 | TColStd_Array1OfReal W2(1,nbp2); |
118 | W2.Init(1.); |
119 | TColStd_Array1OfReal K2(1,nbk2); |
120 | TColStd_Array1OfInteger M2(1,nbk2); |
121 | |
122 | C2->Poles(P2); |
123 | if( C2->IsRational()) |
124 | C2->Weights(W2); |
125 | C2->Knots(K2); |
126 | C2->Multiplicities(M2); |
127 | |
128 | Standard_Real K11 = K1( 1 ); |
129 | Standard_Real K12 = K1(nbk1); |
130 | Standard_Real K21 = K2( 1 ); |
131 | Standard_Real K22 = K2(nbk2); |
132 | |
133 | if ( (K12-K11) > (K22-K21)) { |
134 | BSplCLib::Reparametrize( K11, K12, K2); |
135 | C2->SetKnots(K2); |
136 | } |
137 | else if ( (K12-K11) < (K22-K21)) { |
138 | BSplCLib::Reparametrize( K21, K22, K1); |
139 | C1->SetKnots(K1); |
140 | } |
141 | else if(Abs(K12-K11) > Precision::PConfusion()) { |
142 | BSplCLib::Reparametrize( K11, K12, K2); |
143 | C2->SetKnots(K2); |
144 | } |
145 | |
146 | Standard_Integer NP,NK; |
147 | if ( BSplCLib::PrepareInsertKnots(C1->Degree(),Standard_False, |
148 | K1,M1,K2,M2,NP,NK,Precision::PConfusion(), |
149 | Standard_False)) { |
150 | TColgp_Array1OfPnt NewP(1, NP); |
151 | TColStd_Array1OfReal NewW(1, NP); |
152 | TColStd_Array1OfReal NewK(1, NK); |
153 | TColStd_Array1OfInteger NewM(1, NK); |
154 | BSplCLib::InsertKnots(C1->Degree(),Standard_False, |
155 | P1,W1,K1,M1,K2,M2, |
156 | NewP,NewW,NewK,NewM,Precision::PConfusion(), |
157 | Standard_False); |
158 | if ( C1->IsRational()) { |
159 | C1 = new Geom_BSplineCurve(NewP,NewW,NewK,NewM,C1->Degree()); |
160 | } |
161 | else { |
162 | C1 = new Geom_BSplineCurve(NewP,NewK,NewM,C1->Degree()); |
163 | } |
164 | BSplCLib::InsertKnots(C2->Degree(),Standard_False, |
165 | P2,W2,K2,M2,K1,M1, |
166 | NewP,NewW,NewK,NewM,Precision::PConfusion(), |
167 | Standard_False); |
168 | if ( C2->IsRational()) { |
169 | C2 = new Geom_BSplineCurve(NewP,NewW,NewK,NewM,C2->Degree()); |
170 | } |
171 | else { |
172 | C2 = new Geom_BSplineCurve(NewP,NewK,NewM,C2->Degree()); |
173 | } |
174 | } |
175 | else { |
176 | Standard_ConstructionError::Raise(" "); |
177 | } |
178 | |
179 | return C1->NbPoles(); |
180 | } |
181 | |
182 | |
183 | //======================================================================= |
184 | //function : GeomFill_BSplineCurves |
185 | //purpose : |
186 | //======================================================================= |
187 | |
188 | GeomFill_BSplineCurves::GeomFill_BSplineCurves() |
189 | { |
190 | } |
191 | |
192 | |
193 | //======================================================================= |
194 | //function : GeomFill_BSplineCurves |
195 | //purpose : |
196 | //======================================================================= |
197 | |
198 | GeomFill_BSplineCurves::GeomFill_BSplineCurves |
199 | (const Handle(Geom_BSplineCurve)& C1, |
200 | const Handle(Geom_BSplineCurve)& C2, |
201 | const Handle(Geom_BSplineCurve)& C3, |
202 | const Handle(Geom_BSplineCurve)& C4, |
203 | const GeomFill_FillingStyle Type ) |
204 | { |
205 | Init( C1, C2, C3, C4, Type); |
206 | } |
207 | |
208 | |
209 | //======================================================================= |
210 | //function : GeomFill_BSplineCurves |
211 | //purpose : |
212 | //======================================================================= |
213 | |
214 | GeomFill_BSplineCurves::GeomFill_BSplineCurves |
215 | (const Handle(Geom_BSplineCurve)& C1, |
216 | const Handle(Geom_BSplineCurve)& C2, |
217 | const Handle(Geom_BSplineCurve)& C3, |
218 | const GeomFill_FillingStyle Type ) |
219 | { |
220 | Init( C1, C2, C3, Type); |
221 | } |
222 | |
223 | |
224 | //======================================================================= |
225 | //function : GeomFill_BSplineCurves |
226 | //purpose : |
227 | //======================================================================= |
228 | |
229 | GeomFill_BSplineCurves::GeomFill_BSplineCurves |
230 | (const Handle(Geom_BSplineCurve)& C1, |
231 | const Handle(Geom_BSplineCurve)& C2, |
232 | const GeomFill_FillingStyle Type ) |
233 | { |
234 | Init( C1, C2, Type); |
235 | } |
236 | |
237 | |
238 | //======================================================================= |
239 | //function : Init |
240 | //purpose : |
241 | //======================================================================= |
242 | |
243 | void GeomFill_BSplineCurves::Init |
244 | (const Handle(Geom_BSplineCurve)& C1, |
245 | const Handle(Geom_BSplineCurve)& C2, |
246 | const Handle(Geom_BSplineCurve)& C3, |
247 | const Handle(Geom_BSplineCurve)& C4, |
248 | const GeomFill_FillingStyle Type ) |
249 | { |
250 | // On ordonne les courbes |
251 | Handle(Geom_BSplineCurve) CC1, CC2, CC3, CC4; |
252 | |
253 | Standard_Real Tol = Precision::Confusion(); |
254 | #ifndef No_Exception |
255 | Standard_Boolean IsOK = |
256 | #endif |
257 | Arrange( C1, C2, C3, C4, CC1, CC2, CC3, CC4, Tol); |
258 | |
259 | Standard_ConstructionError_Raise_if |
260 | (!IsOK, " GeomFill_BSplineCurves: Courbes non jointives"); |
261 | |
262 | // Mise en conformite des degres |
263 | Standard_Integer Deg1 = CC1->Degree(); |
264 | Standard_Integer Deg2 = CC2->Degree(); |
265 | Standard_Integer Deg3 = CC3->Degree(); |
266 | Standard_Integer Deg4 = CC4->Degree(); |
267 | Standard_Integer DegU = Max( Deg1, Deg3); |
268 | Standard_Integer DegV = Max( Deg2, Deg4); |
269 | if ( Deg1 < DegU) CC1->IncreaseDegree(DegU); |
270 | if ( Deg2 < DegV) CC2->IncreaseDegree(DegV); |
271 | if ( Deg3 < DegU) CC3->IncreaseDegree(DegU); |
272 | if ( Deg4 < DegV) CC4->IncreaseDegree(DegV); |
273 | |
274 | // Mise en conformite des distributions de noeuds |
275 | Standard_Integer NbUPoles = SetSameDistribution(CC1,CC3); |
276 | Standard_Integer NbVPoles = SetSameDistribution(CC2,CC4); |
277 | |
278 | if(Type == GeomFill_CoonsStyle) { |
279 | Standard_ConstructionError_Raise_if |
280 | (NbUPoles < 4 || NbVPoles < 4, " GeomFill_BSplineCurves: invalid filling style"); |
281 | } |
282 | |
283 | |
284 | TColgp_Array1OfPnt P1(1,NbUPoles); |
285 | TColgp_Array1OfPnt P2(1,NbVPoles); |
286 | TColgp_Array1OfPnt P3(1,NbUPoles); |
287 | TColgp_Array1OfPnt P4(1,NbVPoles); |
288 | CC1->Poles(P1); |
289 | CC2->Poles(P2); |
290 | CC3->Poles(P3); |
291 | CC4->Poles(P4); |
292 | |
293 | // Traitement des courbes rationelles |
294 | Standard_Boolean isRat = ( CC1->IsRational() || CC2->IsRational() || |
295 | CC3->IsRational() || CC4->IsRational() ); |
296 | |
297 | TColStd_Array1OfReal W1(1,NbUPoles); |
298 | TColStd_Array1OfReal W3(1,NbUPoles); |
299 | TColStd_Array1OfReal W2(1,NbVPoles); |
300 | TColStd_Array1OfReal W4(1,NbVPoles); |
301 | W1.Init(1.); |
302 | W2.Init(1.); |
303 | W3.Init(1.); |
304 | W4.Init(1.); |
305 | if ( isRat) { |
306 | if (CC1->IsRational()) { |
307 | CC1->Weights(W1); |
308 | } |
309 | if (CC2->IsRational()) { |
310 | CC2->Weights(W2); |
311 | } |
312 | if (CC3->IsRational()) { |
313 | CC3->Weights(W3); |
314 | } |
315 | if (CC4->IsRational()) { |
316 | CC4->Weights(W4); |
317 | } |
318 | } |
319 | |
320 | GeomFill_Filling Caro; |
321 | if (isRat) { |
322 | switch (Type) |
323 | { |
324 | case GeomFill_StretchStyle : |
325 | Caro = GeomFill_Stretch( P1, P2, P3, P4, W1, W2, W3, W4); |
326 | break; |
327 | case GeomFill_CoonsStyle : |
328 | Caro = GeomFill_Coons ( P1, P4, P3, P2, W1, W4, W3, W2); |
329 | break; |
330 | case GeomFill_CurvedStyle : |
331 | Caro = GeomFill_Curved ( P1, P2, P3, P4, W1, W2, W3, W4); |
332 | break; |
333 | } |
334 | } |
335 | else { |
336 | switch (Type) |
337 | { |
338 | case GeomFill_StretchStyle : |
339 | Caro = GeomFill_Stretch( P1, P2, P3, P4); |
340 | break; |
341 | case GeomFill_CoonsStyle : |
342 | Caro = GeomFill_Coons ( P1, P4, P3, P2); |
343 | break; |
344 | case GeomFill_CurvedStyle : |
345 | Caro = GeomFill_Curved ( P1, P2, P3, P4); |
346 | break; |
347 | } |
348 | } |
349 | |
350 | NbUPoles = Caro.NbUPoles(); |
351 | NbVPoles = Caro.NbVPoles(); |
352 | TColgp_Array2OfPnt Poles(1,NbUPoles,1,NbVPoles); |
353 | |
354 | |
355 | // Creation de la surface |
356 | Standard_Integer NbUKnot = CC1->NbKnots(); |
357 | TColStd_Array1OfReal UKnots(1,NbUKnot); |
358 | TColStd_Array1OfInteger UMults(1,NbUKnot); |
359 | CC1->Knots(UKnots); |
360 | CC1->Multiplicities(UMults); |
361 | |
362 | Standard_Integer NbVKnot = CC2->NbKnots(); |
363 | TColStd_Array1OfReal VKnots(1,NbVKnot); |
364 | TColStd_Array1OfInteger VMults(1,NbVKnot); |
365 | CC2->Knots(VKnots); |
366 | CC2->Multiplicities(VMults); |
367 | |
368 | Caro.Poles(Poles); |
369 | |
370 | if (Caro.isRational()) { |
371 | TColStd_Array2OfReal Weights(1,NbUPoles, 1,NbVPoles); |
372 | Caro.Weights(Weights); |
373 | mySurface = new Geom_BSplineSurface(Poles , Weights, |
374 | UKnots , VKnots, |
375 | UMults , VMults, |
376 | CC1->Degree(), CC2->Degree()); |
377 | } |
378 | else { |
379 | mySurface = new Geom_BSplineSurface(Poles , |
380 | UKnots , VKnots, |
381 | UMults , VMults, |
382 | CC1->Degree(), CC2->Degree()); |
383 | } |
384 | |
385 | } |
386 | |
387 | |
388 | //======================================================================= |
389 | //function : Init |
390 | //purpose : |
391 | //======================================================================= |
392 | |
393 | void GeomFill_BSplineCurves::Init |
394 | (const Handle(Geom_BSplineCurve)& C1, |
395 | const Handle(Geom_BSplineCurve)& C2, |
396 | const Handle(Geom_BSplineCurve)& C3, |
397 | const GeomFill_FillingStyle Type ) |
398 | { |
399 | Handle(Geom_BSplineCurve) C4; |
400 | TColgp_Array1OfPnt Poles(1,2); |
401 | TColStd_Array1OfReal Knots(1,2); |
402 | TColStd_Array1OfInteger Mults(1,2); |
403 | Standard_Real Tol = Precision::Confusion(); |
404 | Tol = Tol * Tol; |
405 | if(C1->StartPoint().SquareDistance(C2->StartPoint()) > Tol && |
406 | C1->StartPoint().SquareDistance(C2->EndPoint()) > Tol ) |
407 | Poles( 1) = C1->StartPoint(); |
408 | else |
409 | Poles( 1) = C1->EndPoint(); |
410 | |
411 | if(C3->StartPoint().SquareDistance(C2->StartPoint()) > Tol && |
412 | C3->StartPoint().SquareDistance(C2->EndPoint()) > Tol ) |
413 | Poles( 2) = C3->StartPoint(); |
414 | else |
415 | Poles( 2) = C3->EndPoint(); |
416 | |
417 | Knots( 1) = C2->Knot(C2->FirstUKnotIndex()); |
418 | Knots( 2) = C2->Knot(C2->LastUKnotIndex()); |
419 | Mults( 1) = Mults( 2) = 2; |
420 | C4 = new Geom_BSplineCurve( Poles, Knots, Mults, 1); |
421 | Init( C1, C2, C3, C4, Type); |
422 | } |
423 | |
424 | |
425 | //======================================================================= |
426 | //function : Init |
427 | //purpose : |
428 | //======================================================================= |
429 | |
430 | void GeomFill_BSplineCurves::Init |
431 | (const Handle(Geom_BSplineCurve)& C1, |
432 | const Handle(Geom_BSplineCurve)& C2, |
433 | const GeomFill_FillingStyle Type ) |
434 | { |
435 | Handle(Geom_BSplineCurve) |
436 | CC1 = Handle(Geom_BSplineCurve)::DownCast(C1->Copy()); |
437 | Handle(Geom_BSplineCurve) |
438 | CC2 = Handle(Geom_BSplineCurve)::DownCast(C2->Copy()); |
439 | |
440 | Standard_Integer Deg1 = CC1->Degree(); |
441 | Standard_Integer Deg2 = CC2->Degree(); |
442 | |
443 | Standard_Boolean isRat = ( CC1->IsRational() || CC2->IsRational()); |
444 | |
445 | if ( Type != GeomFill_CurvedStyle) { |
446 | Standard_Integer DegU = Max( Deg1, Deg2); |
447 | |
448 | if ( CC1->Degree() < DegU ) CC1->IncreaseDegree(DegU); |
449 | if ( CC2->Degree() < DegU ) CC2->IncreaseDegree(DegU); |
450 | |
451 | // Mise en conformite des distributions de noeuds |
452 | Standard_Integer NbPoles = SetSameDistribution(CC1,CC2); |
453 | TColgp_Array2OfPnt Poles(1,NbPoles, 1,2); |
454 | TColgp_Array1OfPnt P1( 1, NbPoles); |
455 | TColgp_Array1OfPnt P2( 1, NbPoles); |
456 | CC1->Poles(P1); |
457 | CC2->Poles(P2); |
458 | Standard_Integer i; |
459 | for (i=1; i<=NbPoles; i++) { |
460 | Poles(i, 1) = P1(i); |
461 | Poles(i, 2) = P2(i); |
462 | } |
463 | Standard_Integer NbUKnots = CC1->NbKnots(); |
464 | TColStd_Array1OfReal UKnots( 1, NbUKnots); |
465 | TColStd_Array1OfInteger UMults( 1, NbUKnots); |
466 | CC1->Knots(UKnots); |
467 | CC1->Multiplicities(UMults); |
468 | // Standard_Integer NbVKnots = 2; |
469 | TColStd_Array1OfReal VKnots( 1, 2); |
470 | TColStd_Array1OfInteger VMults( 1, 2); |
471 | VKnots( 1) = 0; |
472 | VKnots( 2) = 1; |
473 | VMults( 1) = 2; |
474 | VMults( 2) = 2; |
475 | |
476 | |
477 | // Traitement des courbes rationelles |
478 | if (isRat) { |
479 | TColStd_Array2OfReal Weights(1,NbPoles, 1,2); |
480 | TColStd_Array1OfReal W1(1,NbPoles); |
481 | TColStd_Array1OfReal W2(1,NbPoles); |
482 | W1.Init(1.); |
483 | W2.Init(1.); |
484 | |
485 | if ( isRat) { |
486 | if (CC1->IsRational()) { |
487 | CC1->Weights(W1); |
488 | } |
489 | if (CC2->IsRational()) { |
490 | CC2->Weights(W2); |
491 | } |
492 | for (i=1; i<=NbPoles; i++) { |
493 | Weights(i, 1) = W1( i); |
494 | Weights(i, 2) = W2( i); |
495 | } |
496 | } |
497 | mySurface = new Geom_BSplineSurface(Poles , Weights, |
498 | UKnots , VKnots, |
499 | UMults , VMults, |
500 | CC1->Degree(), 1, |
501 | CC1->IsPeriodic(), |
502 | Standard_False); |
503 | } |
504 | else { |
505 | mySurface = new Geom_BSplineSurface(Poles , |
506 | UKnots , VKnots, |
507 | UMults , VMults, |
508 | CC1->Degree(), 1); |
509 | } |
510 | } |
511 | else { |
512 | Standard_Real Eps = Precision::Confusion(); |
513 | Standard_Boolean IsOK = Standard_False; |
514 | if ( CC1->StartPoint().IsEqual(CC2->StartPoint(),Eps)) { |
515 | IsOK = Standard_True; |
516 | } |
517 | else if ( CC1->StartPoint().IsEqual(CC2->EndPoint(),Eps)) { |
518 | CC2->Reverse(); |
519 | IsOK = Standard_True; |
520 | } |
521 | else if ( CC1->EndPoint().IsEqual(CC2->StartPoint(),Eps)) { |
522 | C1->Reverse(); |
523 | IsOK = Standard_True; |
524 | } |
525 | else if ( CC1->EndPoint().IsEqual(CC2->EndPoint(),Eps)) { |
526 | CC1->Reverse(); |
527 | CC2->Reverse(); |
528 | IsOK = Standard_True; |
529 | } |
530 | |
531 | Standard_ConstructionError_Raise_if |
532 | (!IsOK, " GeomFill_BSplineCurves: Courbes non jointives"); |
533 | |
534 | Standard_Integer NbUPoles = CC1->NbPoles(); |
535 | Standard_Integer NbVPoles = CC2->NbPoles(); |
536 | TColgp_Array1OfPnt P1(1,NbUPoles); |
537 | TColgp_Array1OfPnt P2(1,NbVPoles); |
538 | CC1->Poles(P1); |
539 | CC2->Poles(P2); |
540 | |
541 | Standard_Integer NbUKnots = CC1->NbKnots(); |
542 | Standard_Integer NbVKnots = CC2->NbKnots(); |
543 | TColStd_Array1OfReal UKnots(1,NbUKnots); |
544 | TColStd_Array1OfReal VKnots(1,NbVKnots); |
545 | TColStd_Array1OfInteger UMults(1,NbUKnots); |
546 | TColStd_Array1OfInteger VMults(1,NbVKnots); |
547 | CC1->Knots(UKnots); |
548 | CC1->Multiplicities(UMults); |
549 | CC2->Knots(VKnots); |
550 | CC2->Multiplicities(VMults); |
551 | |
552 | TColStd_Array1OfReal W1(1,NbUPoles); |
553 | TColStd_Array1OfReal W2(1,NbVPoles); |
554 | W1.Init(1.); |
555 | W2.Init(1.); |
556 | |
557 | GeomFill_Filling Caro; |
558 | if ( isRat) { |
559 | if (CC1->IsRational()) { |
560 | CC1->Weights(W1); |
561 | } |
562 | if (CC2->IsRational()) { |
563 | CC2->Weights(W2); |
564 | } |
565 | Caro = GeomFill_Curved( P1, P2, W1, W2); |
566 | } |
567 | else { |
568 | Caro = GeomFill_Curved( P1, P2); |
569 | } |
570 | |
571 | NbUPoles = Caro.NbUPoles(); |
572 | NbVPoles = Caro.NbVPoles(); |
573 | TColgp_Array2OfPnt Poles(1,NbUPoles,1,NbVPoles); |
574 | |
575 | Caro.Poles(Poles); |
576 | |
577 | if (Caro.isRational()) { |
578 | TColStd_Array2OfReal Weights(1,NbUPoles, 1,NbVPoles); |
579 | Caro.Weights(Weights); |
580 | mySurface = new Geom_BSplineSurface(Poles , Weights, |
581 | UKnots , VKnots, |
582 | UMults , VMults, |
583 | Deg1 , Deg2, |
584 | Standard_False, Standard_False); |
585 | } |
586 | else { |
587 | mySurface = new Geom_BSplineSurface(Poles , |
588 | UKnots , VKnots, |
589 | UMults , VMults, |
590 | Deg1 , Deg2, |
591 | Standard_False, Standard_False); |
592 | } |
593 | } |
594 | } |
595 | |
596 | |