b311480e |
1 | // Created on: 1997-07-11 |
2 | // Created by: Philippe MANGIN |
3 | // Copyright (c) 1997-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 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Adaptor3d_HCurve.hxx> |
7fd59977 |
19 | #include <GCPnts_QuasiUniformDeflection.hxx> |
42cf5bc1 |
20 | #include <GeomFill.hxx> |
21 | #include <GeomFill_CircularBlendFunc.hxx> |
22 | #include <gp_Pnt.hxx> |
7fd59977 |
23 | #include <Precision.hxx> |
42cf5bc1 |
24 | #include <Standard_OutOfRange.hxx> |
25 | #include <Standard_Type.hxx> |
7fd59977 |
26 | #include <TColStd_Array1OfReal.hxx> |
42cf5bc1 |
27 | #include <TColStd_SequenceOfReal.hxx> |
7fd59977 |
28 | |
92efcf78 |
29 | IMPLEMENT_STANDARD_RTTIEXT(GeomFill_CircularBlendFunc,Approx_SweepFunction) |
30 | |
7fd59977 |
31 | #if DRAW |
32 | #include <GeomAdaptor_HCurve.hxx> |
33 | #include <Geom_BSplineCurve.hxx> |
34 | #include <DrawTrSurf.hxx> |
35 | static Standard_Integer NbSections = 0; |
36 | #endif |
37 | |
d804b26d |
38 | const Standard_Real TolAng = 1.e-6; |
39 | |
7fd59977 |
40 | GeomAbs_Shape GeomFillNextShape(const GeomAbs_Shape S) |
41 | { |
42 | switch (S) { |
43 | case GeomAbs_C0 : |
44 | return GeomAbs_C1; |
45 | case GeomAbs_C1 : |
46 | return GeomAbs_C2; |
47 | case GeomAbs_C2 : |
48 | return GeomAbs_C3; |
49 | case GeomAbs_C3 : |
50 | return GeomAbs_CN; |
51 | default : |
52 | return GeomAbs_CN; |
53 | } |
54 | } |
55 | |
56 | void GeomFillFusInt(const TColStd_Array1OfReal& I1, |
57 | const TColStd_Array1OfReal& I2, |
58 | TColStd_SequenceOfReal& Seq) |
59 | { |
60 | Standard_Integer ind1=1, ind2=1; |
61 | Standard_Real Epspar = Precision::PConfusion()*0.99; |
62 | // en suposant que le positionement fonctionne a PConfusion()/2 |
63 | Standard_Real v1, v2; |
64 | // Initialisations : les IND1 et IND2 pointent sur le 1er element |
65 | // de chacune des 2 tables a traiter. |
66 | |
67 | |
68 | //--- On remplit TABSOR en parcourant TABLE1 et TABLE2 simultanement --- |
69 | //------------------ en eliminant les occurrences multiples ------------ |
70 | |
71 | while ((ind1<=I1.Upper()) && (ind2<=I2.Upper())) { |
72 | v1 = I1(ind1); |
73 | v2 = I2(ind2); |
74 | if (Abs(v1-v2)<= Epspar) { |
75 | // Ici les elements de I1 et I2 conviennent . |
76 | Seq.Append((v1+v2)/2); |
77 | ind1++; |
78 | ind2++; |
79 | } |
80 | else if (v1 < v2) { |
81 | // Ici l' element de I1 convient. |
82 | Seq.Append(v1); |
83 | ind1++; |
84 | } |
85 | else { |
86 | // Ici l' element de TABLE2 convient. |
87 | Seq.Append(v2); |
88 | ind2++; |
89 | } |
90 | } |
91 | |
92 | if (ind1>I1.Upper()) { |
93 | //----- Ici I1 est epuise, on complete avec la fin de TABLE2 ------- |
94 | |
95 | for (; ind2<=I2.Upper(); ind2++) { |
96 | Seq.Append(I2(ind2)); |
97 | } |
98 | } |
99 | |
100 | if (ind2>I2.Upper()) { |
101 | //----- Ici I2 est epuise, on complete avec la fin de I1 ------- |
102 | |
103 | for (; ind1<=I1.Upper(); ind1++) { |
104 | Seq.Append(I1(ind1)); |
105 | } |
106 | } |
107 | } |
108 | |
109 | |
110 | GeomFill_CircularBlendFunc:: |
111 | GeomFill_CircularBlendFunc(const Handle(Adaptor3d_HCurve)& Path, |
112 | const Handle(Adaptor3d_HCurve)& Curve1, |
113 | const Handle(Adaptor3d_HCurve)& Curve2, |
114 | const Standard_Real Radius, |
115 | const Standard_Boolean Polynomial) |
116 | : maxang(RealFirst()), |
117 | minang(RealLast()), |
118 | distmin(RealLast()) |
119 | { |
120 | // Recopie des arguments |
121 | myPath = myTPath = Path; |
122 | myCurve1 = myTCurve1 = Curve1; |
123 | myCurve2 = myTCurve2 = Curve2; |
124 | myRadius = Radius; |
125 | |
126 | // Estimations numeriques |
127 | Discret(); |
128 | |
129 | // Type de convertion ? |
130 | if (Polynomial) myTConv=Convert_Polynomial; |
c6541a0c |
131 | else if(maxang > 0.65*M_PI) |
7fd59977 |
132 | myTConv=Convert_QuasiAngular; //car c'est Continue |
133 | else myTConv = Convert_TgtThetaOver2; |
134 | //car c'est le plus performant |
135 | |
136 | // On en deduit la structure |
137 | GeomFill::GetShape(maxang, |
138 | myNbPoles, myNbKnots, |
139 | myDegree, myTConv); |
140 | } |
141 | |
142 | void GeomFill_CircularBlendFunc::Discret() |
143 | { |
144 | Standard_Real TFirst = myPath->FirstParameter(); |
145 | Standard_Real TLast = myPath->LastParameter(), T; |
146 | Standard_Integer ii; |
147 | Standard_Real L1, L2, L; |
148 | Handle(Adaptor3d_HCurve) C; |
149 | gp_Pnt P1, P2, P3, Center; |
150 | gp_Vec DCenter; |
151 | |
152 | P1 = myCurve1->Value(TFirst); |
153 | P2 = myCurve1->Value((TFirst+TLast)/2.); |
154 | P3 = myCurve1->Value(TLast); |
155 | L1 = P1.Distance(P2) + P2.Distance(P3); |
156 | |
157 | P1 = myCurve2->Value(TFirst); |
158 | P2 = myCurve2->Value((TFirst+TLast)/2.); |
159 | P3 = myCurve2->Value(TLast); |
160 | L2 = P1.Distance(P2) + P2.Distance(P3); |
161 | |
162 | if (L1>L2) { |
163 | L = L1; |
164 | C = myCurve1; |
165 | } |
166 | else { |
167 | L = L2; |
168 | C = myCurve2; |
169 | } |
170 | |
171 | Standard_Real Fleche = 1.e-2 * L; |
172 | Standard_Real Angle, Cosa, Percent; |
173 | GCPnts_QuasiUniformDeflection Samp; |
174 | Samp.Initialize(C->GetCurve(), Fleche); |
175 | myBary.SetCoord(0.,0.,0.); |
176 | gp_Vec ns1, ns2; |
177 | |
178 | if (Samp.IsDone()) { |
179 | Percent = ((Standard_Real)1)/(2*Samp.NbPoints()); |
180 | // char name[100]; |
181 | for (ii=1; ii<=Samp.NbPoints(); ii++) { |
182 | T = Samp.Parameter(ii); |
183 | myCurve1->D0(T, P1); |
184 | myCurve2->D0(T, P2); |
185 | /* |
186 | sprintf(name,"PNT_%d",NbSections++); |
187 | DrawTrSurf::Set(name, P1); |
188 | sprintf(name,"PNT_%d",NbSections++); |
189 | DrawTrSurf::Set(name, P2);*/ |
190 | myPath->D0(T, Center); |
191 | ns1.SetXYZ( Center.XYZ() - P1.XYZ()); |
192 | ns2.SetXYZ( Center.XYZ() - P2.XYZ()); |
193 | ns1.Normalize(); |
194 | ns2.Normalize(); |
195 | Cosa = ns1.Dot(ns2); |
196 | if(Cosa > 1.) {Cosa = 1.;} |
197 | Angle = Abs(ACos(Cosa)); |
198 | if (Angle>maxang) maxang = Angle; |
199 | if (Angle<minang) minang = Angle; |
200 | distmin = Min( distmin, P1.Distance(P2)); |
201 | myBary.ChangeCoord() += (P1.XYZ()+P2.XYZ()); |
202 | } |
203 | } |
204 | else { |
205 | Standard_Real Delta = (TLast-TFirst)/20; |
206 | Percent = ((Standard_Real)1)/42; |
207 | for (ii=0, T=TFirst; ii<=20; ii++, T+=Delta) { |
208 | myCurve1->D0(T, P1); |
209 | myCurve2->D0(T, P2); |
210 | myPath->D0(T, Center); |
211 | |
212 | ns1.SetXYZ( Center.XYZ() - P1.XYZ()); |
213 | ns2.SetXYZ( Center.XYZ() - P2.XYZ()); |
214 | ns1.Normalize(); |
215 | ns2.Normalize(); |
216 | Cosa = ns1.Dot(ns2); |
217 | if(Cosa > 1.) Cosa = 1.; |
218 | Angle = Abs(ACos(Cosa)); |
219 | |
220 | if (Angle>maxang) maxang = Angle; |
221 | if (Angle<minang) minang = Angle; |
222 | distmin = Min( distmin, P1.Distance(P2)); |
223 | myBary.ChangeCoord() += (P1.XYZ()+P2.XYZ()); |
224 | } |
225 | } |
226 | myBary.ChangeCoord() *= Percent; |
227 | |
228 | // Faut il inverser la trajectoire ? |
229 | T = (TFirst + TLast)/2; |
230 | myCurve1->D0(T, P1); |
231 | myCurve2->D0(T, P2); |
232 | myPath->D1(T, Center, DCenter); |
233 | |
234 | ns1.SetXYZ( Center.XYZ() - P1.XYZ()); |
235 | ns2.SetXYZ( Center.XYZ() - P2.XYZ()); |
236 | |
d804b26d |
237 | //myreverse = (DCenter.Dot(ns1.Crossed(ns2)) < 0); |
238 | myreverse = Standard_False; |
7fd59977 |
239 | } |
240 | |
241 | |
242 | |
243 | Standard_Boolean GeomFill_CircularBlendFunc::D0(const Standard_Real Param, |
244 | const Standard_Real, |
245 | const Standard_Real, |
246 | TColgp_Array1OfPnt& Poles, |
247 | TColgp_Array1OfPnt2d&, |
248 | TColStd_Array1OfReal& Weigths) |
249 | { |
250 | gp_Pnt P1, P2, Center; |
251 | gp_Vec ns1, ns2, nplan; |
252 | gp_XYZ temp; |
253 | |
254 | // Positionnement |
255 | myTPath->D0(Param, Center); |
256 | myTCurve1->D0(Param, P1); |
257 | myTCurve2->D0(Param, P2); |
258 | ns1.SetXYZ( Center.XYZ() - P1.XYZ()); |
259 | ns2.SetXYZ( Center.XYZ() - P2.XYZ()); |
d804b26d |
260 | if (!ns1.IsParallel(ns2, TolAng)) nplan = ns1.Crossed(ns2); |
7fd59977 |
261 | else { |
262 | myTPath->D1(Param, Center, nplan); |
263 | if (myreverse) nplan.Reverse(); |
264 | } |
265 | |
266 | // Normalisation |
267 | ns1.Normalize(); |
268 | ns2.Normalize(); |
269 | nplan.Normalize(); |
270 | |
271 | temp.SetLinearForm(myRadius, ns1.XYZ(), |
272 | myRadius, ns2.XYZ(), |
273 | 1, P1.XYZ(), |
274 | P2.XYZ()); |
275 | Center.ChangeCoord() = 0.5*temp; |
276 | |
277 | // Section |
278 | GeomFill::GetCircle(myTConv, |
279 | ns1, ns2, nplan, |
280 | P1, P2, |
281 | myRadius, Center, |
282 | Poles, Weigths); |
283 | |
284 | #if DRAW |
285 | // Handle(Geom_BSplineCurve) BS = |
286 | // new Geom_BSplineCurve(Poles,Weights,Knots,Mults,Degree); |
287 | // sprintf(name,"SECT_%d",NbSections++); |
288 | // DrawTrSurf::Set(name,BS); |
289 | #endif |
290 | return Standard_True; |
291 | } |
292 | |
293 | |
294 | Standard_Boolean GeomFill_CircularBlendFunc::D1(const Standard_Real Param, |
295 | // const Standard_Real First, |
296 | const Standard_Real , |
297 | // const Standard_Real Last, |
298 | const Standard_Real , |
299 | TColgp_Array1OfPnt& Poles, |
300 | TColgp_Array1OfVec& DPoles, |
301 | // TColgp_Array1OfPnt2d& Poles2d, |
302 | TColgp_Array1OfPnt2d& , |
303 | // TColgp_Array1OfVec2d& DPoles2d, |
304 | TColgp_Array1OfVec2d& , |
305 | TColStd_Array1OfReal& Weigths, |
306 | TColStd_Array1OfReal& DWeigths) |
307 | { |
308 | gp_Pnt P1, P2, Center; |
309 | Standard_Real invnorm1, invnorm2, invnormp; |
310 | // gp_Vec DCenter, D2Center, nplan, dnplan, DP1, DP2; |
311 | gp_Vec DCenter, nplan, dnplan, DP1, DP2; |
312 | // gp_Vec ns1, ns2, Dns1, Dns2, vtmp; |
313 | gp_Vec ns1, ns2, Dns1, Dns2; |
314 | gp_XYZ temp; |
315 | |
316 | // Positionemment |
317 | myTPath ->D1(Param, Center, DCenter); |
318 | myTCurve1->D1(Param, P1, DP1); |
319 | myTCurve2->D1(Param, P2, DP2); |
320 | |
321 | ns1.SetXYZ( Center.XYZ() - P1.XYZ()); |
322 | ns2.SetXYZ( Center.XYZ() - P2.XYZ()); |
323 | Dns1 = DCenter - DP1; |
324 | Dns2 = DCenter - DP2; |
325 | |
d804b26d |
326 | if (!ns1.IsParallel(ns2, TolAng)) { |
7fd59977 |
327 | nplan = ns1.Crossed(ns2); |
328 | dnplan = Dns1.Crossed(ns2).Added( ns1.Crossed(Dns2)); |
329 | } |
330 | else { |
331 | myTPath->D2(Param, Center, nplan, dnplan); |
332 | if (myreverse) { |
333 | nplan.Reverse(); |
334 | dnplan.Reverse(); |
335 | } |
336 | } |
337 | |
338 | // Normalisation |
339 | invnorm1 = ((Standard_Real) 1) / ns1.Magnitude(); |
340 | invnorm2 = ((Standard_Real) 1) / ns2.Magnitude(); |
341 | |
342 | ns1 *= invnorm1; |
343 | Dns1.SetLinearForm( -Dns1.Dot(ns1), ns1, Dns1); |
344 | Dns1 *= invnorm1; |
345 | |
346 | ns2 *= invnorm2; |
347 | Dns2.SetLinearForm(-Dns2.Dot(ns2), ns2, Dns2); |
348 | Dns2 *= invnorm2; |
349 | |
350 | temp.SetLinearForm(myRadius, ns1.XYZ(), |
351 | myRadius, ns2.XYZ(), |
352 | 1, P1.XYZ(), P2.XYZ()); |
353 | Center.ChangeCoord() = 0.5*temp; |
354 | DCenter.SetLinearForm(myRadius, Dns1, |
355 | myRadius, Dns2, |
356 | 1, DP1, DP2); |
357 | DCenter *= 0.5; |
358 | |
359 | invnormp = ((Standard_Real)1) / nplan.Magnitude(); |
360 | nplan *= invnormp; |
361 | dnplan.SetLinearForm(-dnplan.Dot(nplan), nplan, dnplan); |
362 | dnplan *= invnormp; |
363 | |
364 | GeomFill::GetCircle(myTConv, |
365 | ns1, ns2, |
366 | Dns1, Dns2, |
367 | nplan, dnplan, |
368 | P1, P2, |
369 | DP1, DP2, |
370 | myRadius, 0, |
371 | Center, DCenter, |
372 | Poles, DPoles, |
373 | Weigths, DWeigths); |
374 | return Standard_True; |
375 | } |
376 | |
377 | Standard_Boolean GeomFill_CircularBlendFunc::D2(const Standard_Real Param, |
378 | // const Standard_Real First, |
379 | const Standard_Real , |
380 | // const Standard_Real Last, |
381 | const Standard_Real , |
382 | TColgp_Array1OfPnt& Poles, |
383 | TColgp_Array1OfVec& DPoles, |
384 | TColgp_Array1OfVec& D2Poles, |
385 | // TColgp_Array1OfPnt2d& Poles2d, |
386 | TColgp_Array1OfPnt2d& , |
387 | // TColgp_Array1OfVec2d& DPoles2d, |
388 | TColgp_Array1OfVec2d& , |
389 | // TColgp_Array1OfVec2d& D2Poles2d, |
390 | TColgp_Array1OfVec2d& , |
391 | TColStd_Array1OfReal& Weigths, |
392 | TColStd_Array1OfReal& DWeigths, |
393 | TColStd_Array1OfReal& D2Weigths) |
394 | { |
395 | gp_Pnt P1, P2, Center; |
396 | Standard_Real invnorm1, invnorm2, invnormp, sc; |
397 | gp_Vec DCenter, D2Center, DP1, DP2, D2P1, D2P2; |
398 | gp_Vec nplan, dnplan, d2nplan; |
399 | gp_Vec ns1, ns2, Dns1, Dns2, D2ns1, D2ns2; |
400 | gp_XYZ temp; |
401 | |
402 | // Positionement |
403 | myTPath ->D2(Param, Center, DCenter, D2Center); |
404 | myTCurve1->D2(Param, P1, DP1, D2P1); |
405 | myTCurve2->D2(Param, P2, DP2, D2P2); |
406 | |
407 | ns1.SetXYZ( Center.XYZ() - P1.XYZ()); |
408 | Dns1 = DCenter - DP1; |
409 | D2ns1 = D2Center - D2P1; |
410 | ns2.SetXYZ( Center.XYZ() - P2.XYZ()); |
411 | Dns2 = DCenter - DP2; |
412 | D2ns2 = D2Center - D2P2; |
413 | |
d804b26d |
414 | if (!ns1.IsParallel(ns2, TolAng)) { |
7fd59977 |
415 | nplan = ns1.Crossed(ns2); |
416 | dnplan = Dns1.Crossed(ns2).Added( ns1.Crossed(Dns2)); |
417 | d2nplan.SetLinearForm(1, D2ns1.Crossed(ns2), |
418 | 2, Dns1.Crossed(Dns2), |
419 | ns1.Crossed(D2ns2)); |
420 | } |
421 | else { |
422 | myTPath->D3(Param, Center, nplan, dnplan, d2nplan); |
423 | if (myreverse) { |
424 | nplan.Reverse(); |
425 | dnplan.Reverse(); |
426 | d2nplan.Reverse(); |
427 | } |
428 | } |
429 | |
430 | // Normalisation |
431 | invnorm1 = ((Standard_Real) 1) / ns1.Magnitude(); |
432 | invnorm2 = ((Standard_Real) 1) / ns2.Magnitude(); |
433 | |
434 | ns1 *= invnorm1; |
435 | sc = Dns1.Dot(ns1); |
436 | D2ns1.SetLinearForm( 3*sc*sc*invnorm1 - D2ns1.Dot(ns1) |
437 | - invnorm1*Dns1.SquareMagnitude(), ns1, |
438 | -2*sc*invnorm1 , Dns1, |
439 | D2ns1); |
440 | Dns1.SetLinearForm( -Dns1.Dot(ns1), ns1, Dns1); |
441 | D2ns1 *= invnorm1; |
442 | Dns1 *= invnorm1; |
443 | |
444 | |
445 | |
446 | ns2 *= invnorm2; |
447 | sc = Dns2.Dot(ns2); |
448 | D2ns2.SetLinearForm( 3*sc*sc*invnorm2 - D2ns2.Dot(ns2) |
449 | - invnorm2*Dns2.SquareMagnitude(), ns2, |
450 | -2*sc*invnorm2 , Dns2, |
451 | D2ns2); |
452 | Dns2.SetLinearForm(-sc, ns2, Dns2); |
453 | D2ns2 *= invnorm2; |
454 | Dns2 *= invnorm2; |
455 | |
456 | |
457 | temp.SetLinearForm(myRadius, ns1.XYZ(), |
458 | myRadius, ns2.XYZ(), |
459 | 1, P1.XYZ(), P2.XYZ()); |
460 | Center.ChangeCoord() = 0.5*temp; |
461 | DCenter.SetLinearForm(myRadius, Dns1, |
462 | myRadius, Dns2, |
463 | 1, DP1, DP2); |
464 | DCenter *= 0.5; |
465 | D2Center.SetLinearForm(myRadius, D2ns1, |
466 | myRadius, D2ns2, |
467 | 1, D2P1, D2P2); |
468 | D2Center *= 0.5; |
469 | |
470 | invnormp = ((Standard_Real)1) / nplan.Magnitude(); |
471 | nplan *= invnormp; |
472 | sc = dnplan.Dot(nplan); |
473 | d2nplan.SetLinearForm( 3*sc*sc*invnormp - d2nplan.Dot(nplan) |
474 | - invnormp*dnplan.SquareMagnitude(), nplan, |
475 | -2*sc*invnormp , dnplan, |
476 | d2nplan); |
477 | dnplan.SetLinearForm(-sc, nplan, dnplan); |
478 | dnplan *= invnormp; |
479 | d2nplan *= invnormp; |
480 | |
481 | GeomFill::GetCircle(myTConv, |
482 | ns1, ns2, |
483 | Dns1, Dns2, |
484 | D2ns1, D2ns2, |
485 | nplan, dnplan, d2nplan, |
486 | P1, P2, |
487 | DP1, DP2, |
488 | D2P1, D2P2, |
489 | myRadius, 0, 0, |
490 | Center, DCenter, D2Center, |
491 | Poles, DPoles, D2Poles, |
492 | Weigths, DWeigths, D2Weigths); |
493 | return Standard_True; |
494 | } |
495 | |
496 | Standard_Integer GeomFill_CircularBlendFunc::Nb2dCurves() const |
497 | { |
498 | return 0; |
499 | } |
500 | |
501 | void GeomFill_CircularBlendFunc::SectionShape(Standard_Integer& NbPoles, |
502 | Standard_Integer& NbKnots, |
503 | Standard_Integer& Degree) const |
504 | { |
505 | NbPoles = myNbPoles; |
506 | NbKnots = myNbKnots; |
507 | Degree = myDegree; |
508 | } |
509 | |
510 | void GeomFill_CircularBlendFunc::Knots(TColStd_Array1OfReal& TKnots) const |
511 | { |
512 | GeomFill::Knots(myTConv, TKnots); |
513 | } |
514 | |
515 | void GeomFill_CircularBlendFunc::Mults(TColStd_Array1OfInteger& TMults) const |
516 | { |
517 | GeomFill::Mults(myTConv, TMults); |
518 | } |
519 | |
520 | Standard_Boolean GeomFill_CircularBlendFunc::IsRational() const |
521 | { |
522 | return (myTConv != Convert_Polynomial); |
523 | } |
524 | |
525 | Standard_Integer GeomFill_CircularBlendFunc:: |
526 | NbIntervals(const GeomAbs_Shape S) const |
527 | { |
528 | Standard_Integer NbI_Center, NbI_Cb1, NbI_Cb2, ii; |
529 | NbI_Center = myPath->NbIntervals(GeomFillNextShape(S)); |
530 | NbI_Cb1 = myCurve1->NbIntervals(S); |
531 | NbI_Cb2 = myCurve2->NbIntervals(S); |
532 | |
533 | TColStd_Array1OfReal ICenter(1, NbI_Center+1); |
534 | TColStd_Array1OfReal ICb1(1, NbI_Cb1+1); |
535 | TColStd_Array1OfReal ICb2(1, NbI_Cb2+1); |
536 | TColStd_SequenceOfReal Inter; |
537 | |
538 | myPath->Intervals(ICenter, GeomFillNextShape(S)); |
539 | myCurve1->Intervals(ICb1, S); |
540 | myCurve2->Intervals(ICb2, S); |
541 | /* cout << "Intervals : " << S << endl; |
542 | cout << "-- Center-> " << endl; |
543 | for (ii=1; ii<=ICenter.Length(); ii++) cout << " , "<< ICenter(ii); |
544 | cout << endl; cout << endl; |
545 | cout << "-- Cb1-> " << endl; |
546 | for (ii=1; ii<=ICb1.Length(); ii++) cout << " , "<< ICb1(ii); |
547 | cout << endl; cout << endl; |
548 | cout << "-- Cb2-> " << endl; |
549 | for (ii=1; ii<=ICb2.Length(); ii++) cout << " , "<< ICb1(ii); |
550 | cout << endl; cout << endl;*/ |
551 | |
552 | GeomFillFusInt(ICb1, ICb2, Inter); |
553 | |
554 | TColStd_Array1OfReal ICbs (1, Inter.Length()); |
555 | for (ii=1; ii<=ICbs.Length(); ii++) ICbs(ii) = Inter(ii); |
556 | |
557 | Inter.Clear(); |
558 | GeomFillFusInt(ICenter, ICbs, Inter); |
559 | |
560 | return Inter.Length()-1; |
561 | } |
562 | |
563 | void GeomFill_CircularBlendFunc:: |
564 | Intervals(TColStd_Array1OfReal& T, const GeomAbs_Shape S) const |
565 | { |
566 | Standard_Integer NbI_Center, NbI_Cb1, NbI_Cb2, ii; |
567 | NbI_Center = myPath->NbIntervals(GeomFillNextShape(S)); |
568 | NbI_Cb1 = myCurve1->NbIntervals(S); |
569 | NbI_Cb2 = myCurve2->NbIntervals(S); |
570 | |
571 | TColStd_Array1OfReal ICenter(1, NbI_Center+1); |
572 | TColStd_Array1OfReal ICb1(1, NbI_Cb1+1); |
573 | TColStd_Array1OfReal ICb2(1, NbI_Cb2+1); |
574 | TColStd_SequenceOfReal Inter; |
575 | |
576 | myPath->Intervals(ICenter, GeomFillNextShape(S)); |
577 | myCurve1->Intervals(ICb1, S); |
578 | myCurve2->Intervals(ICb2, S); |
579 | |
580 | GeomFillFusInt(ICb1, ICb2, Inter); |
581 | |
582 | TColStd_Array1OfReal ICbs (1, Inter.Length()); |
583 | for (ii=1; ii<=ICbs.Length(); ii++) ICbs(ii) = Inter(ii); |
584 | |
585 | Inter.Clear(); |
586 | GeomFillFusInt(ICenter, ICbs, Inter); |
587 | |
588 | // Recopie du resultat |
589 | for (ii=1; ii<=Inter.Length(); ii++) T(ii) = Inter(ii); |
590 | } |
591 | |
592 | void GeomFill_CircularBlendFunc::SetInterval(const Standard_Real First, |
593 | const Standard_Real Last) |
594 | { |
595 | Standard_Real Eps = Precision::PConfusion(); |
596 | myTPath = myPath->Trim(First, Last, Eps); |
597 | myTCurve1 = myCurve1->Trim(First, Last, Eps); |
598 | myTCurve2 = myCurve2->Trim(First, Last, Eps); |
599 | } |
600 | |
601 | |
602 | void GeomFill_CircularBlendFunc::GetTolerance(const Standard_Real BoundTol, |
603 | const Standard_Real SurfTol, |
604 | const Standard_Real AngleTol, |
605 | TColStd_Array1OfReal& Tol3d) const |
606 | { |
607 | Standard_Integer low = Tol3d.Lower() , up=Tol3d.Upper(); |
608 | Standard_Real Tol; |
609 | |
610 | Tol= GeomFill::GetTolerance(myTConv, minang, |
611 | myRadius, AngleTol, SurfTol); |
612 | Tol3d.Init(SurfTol); |
613 | Tol3d(low+1) = Tol3d(up-1) = Min(Tol, SurfTol); |
614 | Tol3d(low) = Tol3d(up) = Min(Tol, BoundTol); |
615 | } |
616 | |
617 | |
618 | void GeomFill_CircularBlendFunc::SetTolerance(const Standard_Real, |
619 | const Standard_Real) |
620 | { |
621 | // y rien a faire ! |
622 | } |
623 | |
624 | gp_Pnt GeomFill_CircularBlendFunc::BarycentreOfSurf() const |
625 | { |
626 | return myBary; |
627 | } |
628 | |
629 | Standard_Real GeomFill_CircularBlendFunc::MaximalSection() const |
630 | { |
631 | return maxang*myRadius; |
632 | } |
633 | |
634 | void GeomFill_CircularBlendFunc:: |
635 | GetMinimalWeight(TColStd_Array1OfReal& Weigths) const |
636 | { |
637 | GeomFill::GetMinimalWeights(myTConv, minang, maxang, Weigths); |
638 | } |
639 | |