7fd59977 |
1 | // File: ChFi3d_Builder_5.cxx |
2 | // Created: Tue Mar 29 16:13:48 1994 |
3 | // Author: Isabelle GRIGNON |
4 | // Copyright: OPEN CASCADE 1994 |
5 | |
6 | #include <ChFi3d_FilBuilder.jxx> |
7 | |
8 | #include <ChFi3d.hxx> |
9 | #include <ChFi3d_Builder_0.hxx> |
10 | |
11 | #include <StdFail_NotDone.hxx> |
12 | #include <Standard_NotImplemented.hxx> |
13 | #include <Standard_ErrorHandler.hxx> |
14 | |
15 | #include <math_Vector.hxx> |
16 | #include <TColgp_Array1OfPnt.hxx> |
17 | #include <TColgp_Array1OfPnt2d.hxx> |
18 | #include <TColStd_Array1OfReal.hxx> |
19 | #include <TColStd_Array1OfInteger.hxx> |
20 | #include <TColStd_ListOfInteger.hxx> |
21 | #include <gp_Pnt.hxx> |
22 | #include <gp_Pnt2d.hxx> |
23 | #include <gp_Dir.hxx> |
24 | #include <gp_Lin.hxx> |
25 | #include <gp_Pln.hxx> |
26 | #include <gp_Ax3.hxx> |
27 | #include <Geom_BSplineCurve.hxx> |
28 | #include <Geom2d_TrimmedCurve.hxx> |
29 | #include <Geom2d_BSplineCurve.hxx> |
30 | #include <Law_Linear.hxx> |
31 | #include <BRepBlend_CSCircular.hxx> |
32 | #include <BRepBlend_Line.hxx> |
33 | #include <Geom2dConvert.hxx> |
34 | #include <BSplCLib.hxx> |
35 | |
36 | #include <Adaptor3d_CurveOnSurface.hxx> |
37 | #include <Adaptor3d_HCurveOnSurface.hxx> |
38 | #include <BRepLProp_CLProps.hxx> |
39 | #include <GeomAdaptor_Curve.hxx> |
40 | #include <GeomAdaptor_HCurve.hxx> |
41 | #include <Geom2dAdaptor_Curve.hxx> |
42 | #include <Geom2dAdaptor_HCurve.hxx> |
43 | #include <GeomAdaptor_Surface.hxx> |
44 | #include <GeomAdaptor_HSurface.hxx> |
45 | #include <BRep_Tool.hxx> |
46 | #include <BRepAdaptor_Curve2d.hxx> |
47 | #include <BRepAdaptor_Curve.hxx> |
48 | #include <BRepAdaptor_HCurve.hxx> |
49 | #include <BRepAdaptor_Surface.hxx> |
50 | #include <BRepAdaptor_HSurface.hxx> |
51 | #include <BRepTopAdaptor_TopolTool.hxx> |
52 | #include <GeomFill_ConstrainedFilling.hxx> |
53 | #include <GeomFill_SimpleBound.hxx> |
54 | |
55 | #include <IntSurf_LineOn2S.hxx> |
56 | #include <IntSurf_Transition.hxx> |
57 | #include <IntSurf_TypeTrans.hxx> |
58 | #include <IntCurveSurface_HInter.hxx> |
59 | #include <IntCurveSurface_IntersectionPoint.hxx> |
60 | |
61 | #include <TopoDS.hxx> |
62 | #include <TopoDS_Vertex.hxx> |
63 | #include <TopoDS_Face.hxx> |
64 | #include <TopOpeBRepDS_DataStructure.hxx> |
65 | #include <TopOpeBRepDS_ListOfInterference.hxx> |
66 | #include <TopAbs.hxx> |
67 | #include <TopAbs_Orientation.hxx> |
68 | #include <TopExp.hxx> |
69 | #include <TopTools_ListIteratorOfListOfShape.hxx> |
70 | #include <TopOpeBRepDS_HDataStructure.hxx> |
71 | #include <ChFiDS_Regul.hxx> |
72 | #include <ChFiDS_State.hxx> |
73 | #include <ChFiDS_SequenceOfSurfData.hxx> |
74 | #include <ChFiDS_SurfData.hxx> |
75 | #include <ChFiDS_FaceInterference.hxx> |
76 | #include <ChFiDS_ListIteratorOfListOfStripe.hxx> |
77 | #include <ChFiDS_Stripe.hxx> |
78 | #include <ChFiDS_Spine.hxx> |
79 | #include <ChFiDS_FilSpine.hxx> |
80 | #include <ChFiDS_HData.hxx> |
81 | #include <ChFiDS_CommonPoint.hxx> |
82 | |
83 | #include <ChFiKPart_ComputeData.hxx> |
84 | |
85 | #ifdef DRAW |
86 | #include <DrawTrSurf.hxx> |
87 | #endif |
88 | #ifdef DEB |
89 | #include <Geom_TrimmedCurve.hxx> |
90 | extern Standard_Boolean ChFi3d_GettraceDRAWSPINE(); |
91 | extern Standard_Boolean ChFi3d_GetcontextFORCEFILLING(); |
92 | #include <OSD_Chronometer.hxx> |
93 | |
94 | extern Standard_Real t_t2cornerinit ,t_perf2cornerbyinter,t_chfikpartcompdata, |
95 | t_cheminement,t_remplissage,t_t2cornerDS; |
96 | extern void ChFi3d_InitChron(OSD_Chronometer& ch); |
97 | extern void ChFi3d_ResultChron(OSD_Chronometer & ch,Standard_Real& time); |
98 | #endif |
99 | |
100 | //======================================================================= |
101 | //function : ToricRotule |
81bba717 |
102 | //purpose : Test if it is a particular case of torus routine. |
103 | // Three planes with two constant incident fillets |
104 | // of the same radius and the third face perpendicular to |
105 | // two others are required. |
7fd59977 |
106 | //======================================================================= |
107 | |
108 | static Standard_Boolean ToricRotule(const BRepAdaptor_Surface& fac, |
109 | const BRepAdaptor_Surface& s1, |
110 | const BRepAdaptor_Surface& s2, |
111 | const Handle(ChFiDS_Stripe)& c1, |
112 | const Handle(ChFiDS_Stripe)& c2) |
113 | |
114 | { |
115 | Standard_Real tolesp = 1.e-7; |
116 | |
117 | Handle(ChFiDS_FilSpine) sp1=Handle(ChFiDS_FilSpine)::DownCast(c1->Spine()); |
118 | Handle(ChFiDS_FilSpine) sp2=Handle(ChFiDS_FilSpine)::DownCast(c2->Spine()); |
119 | if(sp1.IsNull() || sp2.IsNull()) return Standard_False; |
120 | if (!sp1->IsConstant() || !sp2->IsConstant()) |
121 | return Standard_False; |
122 | if ((fac.GetType() != GeomAbs_Plane) || |
123 | (s1.GetType() != GeomAbs_Plane) || |
124 | (s2.GetType() != GeomAbs_Plane)) return Standard_False; |
125 | gp_Dir df = fac.Plane().Position().Direction(); |
126 | gp_Dir ds1 = s1.Plane().Position().Direction(); |
127 | gp_Dir ds2 = s2.Plane().Position().Direction(); |
128 | if ( Abs(df.Dot(ds1)) >= tolesp || Abs(df.Dot(ds2)) >= tolesp ) |
129 | return Standard_False; |
130 | Standard_Real r1 = sp1->Radius(); |
131 | Standard_Real r2 = sp2->Radius(); |
132 | if(Abs(r1 - r2) >= tolesp) return Standard_False; |
133 | return Standard_True; |
134 | } |
135 | |
136 | static void RemoveSD(Handle(ChFiDS_Stripe)& Stripe, |
137 | const Standard_Integer num1, |
138 | const Standard_Integer num2 ) |
139 | { |
140 | ChFiDS_SequenceOfSurfData& Seq = |
141 | Stripe->ChangeSetOfSurfData()->ChangeSequence(); |
142 | if(Seq.IsEmpty()) return; |
143 | if (num1==num2) |
144 | Seq.Remove(num1); |
145 | else |
146 | Seq.Remove(num1,num2); |
147 | } |
148 | |
149 | |
150 | //======================================================================= |
151 | //function : PerformTwoCorner |
152 | //purpose : |
153 | //======================================================================= |
154 | |
155 | void ChFi3d_FilBuilder::PerformTwoCorner(const Standard_Integer Index) |
156 | { |
157 | #ifdef DEB |
158 | OSD_Chronometer ch; |
159 | ChFi3d_InitChron(ch); // init perf initialisation |
160 | #endif |
161 | |
162 | done = 0; |
163 | const TopoDS_Vertex& Vtx = myVDataMap.FindKey(Index); |
164 | TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS(); |
165 | ChFiDS_ListIteratorOfListOfStripe It; |
166 | It.Initialize(myVDataMap(Index)); |
167 | Handle(ChFiDS_Stripe) st1,st2; |
168 | Standard_Integer Sens1,Sens2; |
169 | Standard_Integer Isd1,Isd2,i1,i2; |
170 | Handle(ChFiDS_SurfData) sd1,sd2; |
171 | ChFiDS_SequenceOfSurfData SeqFil1,SeqFil2; |
172 | Handle(Geom_Surface) surf1,surf2; |
173 | Standard_Boolean OkinterCC,Okvisavis,SameSide; |
174 | Standard_Integer IFaCo1,IFaCo2; |
175 | Standard_Real UIntPC1,UIntPC2; |
176 | TopoDS_Face FaCo; |
177 | TopoDS_Edge E1,E2,E; |
178 | TopoDS_Vertex V1,V2; |
179 | // gp_Pnt P1,P2; |
180 | Standard_Integer nbsurf1,nbsurf2,deb1,fin1,deb2,fin2; |
181 | Standard_Real parE1,parE2; |
81bba717 |
182 | //Necessary information on fillets is extracted |
7fd59977 |
183 | //------------------------------------------------------ |
184 | |
81bba717 |
185 | //the first |
7fd59977 |
186 | //---------- |
187 | |
188 | st1 = It.Value(); |
189 | Isd1 = ChFi3d_IndexOfSurfData(Vtx,st1,Sens1); |
190 | |
191 | |
81bba717 |
192 | //the second |
7fd59977 |
193 | //---------- |
194 | It.Next(); |
195 | st2 = It.Value(); |
196 | if(st2 == st1) { |
197 | Sens2 = -1; |
198 | Isd2 = st2->SetOfSurfData()->Length(); |
199 | } |
200 | else{ Isd2 = ChFi3d_IndexOfSurfData(Vtx,st2,Sens2); } |
201 | |
81bba717 |
202 | // If two edges to rounded are tangent GeomPlate is called |
7fd59977 |
203 | |
204 | if (Sens1==1) E1= st1->Spine()->Edges(1); |
205 | else E1= st1->Spine()->Edges( st1->Spine()->NbEdges()); |
206 | |
207 | if (Sens2==1) E2= st2->Spine()->Edges(1); |
208 | else E2= st2->Spine()->Edges( st2->Spine()->NbEdges()); |
209 | |
210 | BRepAdaptor_Curve BCurv1(E1); |
211 | BRepAdaptor_Curve BCurv2(E2); |
212 | parE1=BRep_Tool::Parameter(Vtx,E1); |
213 | parE2=BRep_Tool::Parameter(Vtx,E2); |
214 | BRepLProp_CLProps CL1(BCurv1,parE1 , 1, 1.e-4); |
215 | BRepLProp_CLProps CL2(BCurv2,parE2 , 1, 1.e-4); |
216 | gp_Dir dir1,dir2 ; |
217 | CL1.Tangent(dir1); |
218 | CL2.Tangent(dir2); |
219 | if (Sens1==-1) dir1.Reverse(); |
220 | if (Sens2==-1) dir2.Reverse(); |
221 | Standard_Real ang1; |
222 | ang1=Abs(dir1.Angle(dir2)); |
223 | if (ang1<PI/180.) { |
224 | PerformMoreThreeCorner(Index,2); |
225 | done=1; |
226 | return; |
227 | } |
228 | |
229 | OkinterCC = ChFi3d_IsInFront(DStr,st1,st2,Isd1,Isd2,Sens1,Sens2, |
230 | UIntPC1,UIntPC2,FaCo,SameSide, |
231 | IFaCo1,IFaCo2,Okvisavis,Vtx,Standard_True); |
232 | |
233 | Standard_Boolean trouve=Standard_False; |
234 | if (!Okvisavis) { |
235 | |
236 | |
81bba717 |
237 | // one is not limited to the first or the last surfdata |
238 | // to find the opposing data |
7fd59977 |
239 | nbsurf1=st1->SetOfSurfData()->Length(); |
240 | nbsurf2=st2->SetOfSurfData()->Length(); |
241 | deb1=1; |
242 | deb2=1; |
243 | fin1=1; |
244 | fin2=1; |
245 | if (nbsurf1!=1) { |
246 | if (Sens1==1) { |
247 | deb1=1; |
248 | fin1=2; |
249 | } |
250 | else { |
251 | deb1=nbsurf1-1; |
252 | fin1=nbsurf1; |
253 | } |
254 | } |
255 | if (nbsurf2!=1) { |
256 | if (Sens2==1 ) { |
257 | deb2=1; |
258 | fin2=2; |
259 | } |
260 | else { |
261 | deb2=nbsurf2-1; |
262 | fin2=nbsurf2; |
263 | } |
264 | } |
265 | |
266 | for (i1=deb1;i1<=fin1 &&!trouve;i1++) { |
267 | Isd1=i1; |
268 | for (i2=deb2;i2<=fin2 &&!trouve;i2++) { |
269 | Isd2=i2; |
270 | |
271 | OkinterCC = ChFi3d_IsInFront(DStr,st1,st2,Isd1,Isd2,Sens1,Sens2, |
272 | UIntPC1,UIntPC2,FaCo,SameSide, |
273 | IFaCo1,IFaCo2,Okvisavis,Vtx,Standard_True); |
274 | trouve=Okvisavis; |
275 | } |
276 | } |
277 | if (!trouve){ |
278 | PerformMoreThreeCorner(Index,2); |
279 | done=1; |
280 | return; |
281 | } |
282 | else { |
283 | if (Sens1==1 && Isd1!=1) RemoveSD(st1,1,1); |
284 | if (Sens1!=1 && Isd1!=nbsurf1) RemoveSD(st1,fin1,fin1); |
285 | if (Sens2==1 && Isd2!=1) RemoveSD(st2,1,1); |
286 | if (Sens2!=1 && Isd2!=nbsurf2) RemoveSD(st2,fin2,fin2); |
287 | |
288 | } |
289 | Isd1=ChFi3d_IndexOfSurfData(Vtx,st1,Sens1); |
290 | Isd2=ChFi3d_IndexOfSurfData(Vtx,st2,Sens2); |
291 | } |
81bba717 |
292 | // StdFail_NotDone::Raise("TwoCorner : no common face"); |
7fd59977 |
293 | Standard_Integer IFaArc1 = 3-IFaCo1, IFaArc2 = 3-IFaCo2; |
294 | SeqFil1 = st1->ChangeSetOfSurfData()->ChangeSequence(); |
295 | SeqFil2 = st2->ChangeSetOfSurfData()->ChangeSequence(); |
296 | sd1 = SeqFil1.ChangeValue(Isd1); |
297 | surf1 = DStr.Surface(sd1->Surf()).Surface(); |
298 | sd2 = SeqFil2.ChangeValue(Isd2); |
299 | surf2 = DStr.Surface(sd2->Surf()).Surface(); |
300 | TopAbs_Orientation OFaCo = FaCo.Orientation(); |
81bba717 |
301 | // The concavities are analyzed and the opposite face and the |
302 | // eventual intersection of 2 pcurves on this face are found. |
7fd59977 |
303 | |
304 | ChFiDS_State Stat1,Stat2; |
305 | Standard_Boolean isfirst1 = (Sens1 == 1); |
306 | Standard_Boolean isfirst2 = (Sens2 == 1); |
307 | Stat1 = st1->Spine()->Status(isfirst1); |
308 | Stat2 = st2->Spine()->Status(isfirst2); |
309 | Standard_Boolean c1biseau = (Stat1 == ChFiDS_AllSame); |
310 | Standard_Boolean c1rotule = (Stat1 == ChFiDS_OnSame && Stat2 == ChFiDS_OnSame); |
311 | |
81bba717 |
312 | // It is checked if the fillets have a commonpoint on a common arc. |
313 | // This edge is the pivot of the bevel or the knee. |
7fd59977 |
314 | |
315 | ChFiDS_CommonPoint& CP1 = sd1->ChangeVertex(isfirst1,IFaArc1); |
316 | ChFiDS_CommonPoint& CP2 = sd2->ChangeVertex(isfirst2,IFaArc2); |
317 | |
318 | Standard_Boolean resetcp1 = 0; |
319 | Standard_Boolean resetcp2 = 0; |
320 | |
321 | TopoDS_Edge pivot; |
322 | Standard_Boolean yapiv = Standard_False; |
323 | if(CP1.IsOnArc()) pivot = CP1.Arc(); |
324 | else { |
325 | PerformMoreThreeCorner(Index,2); |
326 | done=1; |
327 | return; |
328 | } |
329 | if(CP1.IsOnArc()&& CP2.IsOnArc()){ |
330 | yapiv = (pivot.IsSame(CP2.Arc())); |
331 | } |
332 | Handle(BRepAdaptor_HCurve) Hpivot; |
333 | #ifndef DEB |
334 | Standard_Boolean sameparam = Standard_False; |
335 | Standard_Real parCP1 = 0., parCP2 = 0.; |
336 | #else |
337 | Standard_Boolean sameparam; |
338 | Standard_Real parCP1, parCP2; |
339 | #endif |
340 | if(yapiv) { |
341 | Hpivot = new BRepAdaptor_HCurve(pivot); |
342 | parCP1 = CP1.ParameterOnArc(); |
343 | parCP2 = CP2.ParameterOnArc(); |
344 | gp_Pnt tst1 = Hpivot->Value(parCP1); |
345 | gp_Pnt tst2 = Hpivot->Value(parCP2); |
346 | sameparam = tst1.Distance(tst2) <= tolesp; |
347 | } |
348 | Handle(BRepAdaptor_HSurface) HFaCo = new BRepAdaptor_HSurface(); |
349 | Handle(BRepAdaptor_HSurface) HFaPiv; |
350 | Handle(BRepAdaptor_HSurface) HBRS1 = new BRepAdaptor_HSurface(); |
351 | Handle(BRepAdaptor_HSurface) HBRS2 = new BRepAdaptor_HSurface(); |
352 | |
353 | BRepAdaptor_Surface& BRS1 = HBRS1->ChangeSurface(); |
354 | BRepAdaptor_Surface& BRS2 = HBRS2->ChangeSurface(); |
355 | BRepAdaptor_Surface& BRFaCo = HFaCo->ChangeSurface(); |
356 | BRFaCo.Initialize(FaCo); |
357 | |
358 | TopoDS_Face FF1,FF2,F,FaPiv; |
359 | #ifndef DEB |
360 | TopAbs_Orientation pctrans = TopAbs_FORWARD ; |
361 | #else |
362 | TopAbs_Orientation pctrans; |
363 | #endif |
364 | Handle(Geom2d_BSplineCurve) PCurveOnPiv; |
365 | FF1 = TopoDS::Face(DStr.Shape(sd1->Index(IFaArc1))); |
366 | FF2 = TopoDS::Face(DStr.Shape(sd2->Index(IFaArc2))); |
367 | if (FF1.IsNull()||FF2.IsNull()) |
368 | {PerformMoreThreeCorner(Index,2); |
369 | done=1; |
370 | return; |
371 | } |
372 | BRS1.Initialize(FF1); |
373 | BRS2.Initialize(FF2); |
374 | |
375 | if(yapiv ) { |
376 | TopTools_ListIteratorOfListOfShape Kt; |
377 | Standard_Boolean ok1 = Standard_False, ok2 = Standard_False; |
378 | for (Kt.Initialize(myEFMap(pivot)); Kt.More(); Kt.Next()){ |
379 | F = TopoDS::Face(Kt.Value()); |
380 | if(!ok1 && FF1.IsSame(F)){ |
381 | ok1 = Standard_True; |
382 | } |
383 | if(!ok2 && FF2.IsSame(F)){ |
384 | ok2 = Standard_True; |
385 | } |
386 | } |
387 | if(!ok1 || !ok2){ |
7fd59977 |
388 | PerformMoreThreeCorner(Index,2); |
389 | done=1; |
390 | return; |
391 | } |
392 | } |
393 | |
394 | #ifdef DEB |
395 | ChFi3d_ResultChron(ch ,t_t2cornerinit);//result perf initialisation |
396 | #endif |
397 | |
81bba717 |
398 | //bevel |
7fd59977 |
399 | //------ |
400 | ChFiDS_CommonPoint cp11,cp12,cp21,cp22; |
401 | ChFiDS_FaceInterference intf11,intf12,intf21,intf22; |
402 | |
403 | if(c1biseau){ |
404 | #ifdef DEB |
405 | ChFi3d_InitChron(ch); // init perf PerformTwoCornerbyInter |
406 | #endif |
407 | |
408 | done = PerformTwoCornerbyInter(Index); |
409 | |
410 | #ifdef DEB |
411 | ChFi3d_ResultChron(ch , t_perf2cornerbyinter); // result perf PerformTwoCornerbyInter |
412 | #endif |
413 | |
414 | if (!done){ |
415 | PerformMoreThreeCorner(Index,2); |
416 | done=1; |
417 | return; |
418 | } |
419 | } |
81bba717 |
420 | else if(c1rotule){//save. |
7fd59977 |
421 | cp11 = sd1->Vertex(isfirst1,1); |
422 | cp12 = sd1->Vertex(isfirst1,2); |
423 | cp21 = sd2->Vertex(isfirst2,1); |
424 | cp22 = sd2->Vertex(isfirst2,2); |
425 | intf11 = sd1->InterferenceOnS1(); |
426 | intf12 = sd1->InterferenceOnS2(); |
427 | intf21 = sd2->InterferenceOnS1(); |
428 | intf22 = sd2->InterferenceOnS2(); |
429 | #ifdef DEB |
430 | ChFi3d_InitChron(ch); // init perf PerformTwoCornerbyInter |
431 | #endif |
432 | |
433 | done = PerformTwoCornerbyInter(Index); |
434 | |
435 | #ifdef DEB |
436 | ChFi3d_ResultChron(ch , t_perf2cornerbyinter); // result perf PerformTwoCornerbyInter |
437 | #endif |
438 | if (!done) { |
81bba717 |
439 | // restore |
7fd59977 |
440 | sd1->ChangeVertex(isfirst1,1) = cp11; |
441 | sd1->ChangeVertex(isfirst1,2) = cp12; |
442 | sd2->ChangeVertex(isfirst2,1) = cp21; |
443 | sd2->ChangeVertex(isfirst2,2) = cp22; |
444 | sd1->ChangeInterferenceOnS1() = intf11; |
445 | sd1->ChangeInterferenceOnS2() = intf12; |
446 | sd2->ChangeInterferenceOnS1() = intf21; |
447 | sd2->ChangeInterferenceOnS2() = intf22; |
448 | done = 0; |
449 | } |
450 | } |
451 | |
452 | if(!c1biseau && !done){ |
81bba717 |
453 | //new cornerdata is created |
7fd59977 |
454 | //------------------------------- |
455 | Handle(ChFiDS_Stripe) corner = new ChFiDS_Stripe(); |
456 | Handle(ChFiDS_HData)& cornerset = corner->ChangeSetOfSurfData(); |
457 | cornerset = new ChFiDS_HData(); |
458 | Handle(ChFiDS_SurfData) coin = new ChFiDS_SurfData(); |
459 | cornerset->Append(coin); |
460 | |
461 | if (SameSide) { |
462 | if(ToricRotule(BRFaCo,BRS1,BRS2,st1,st2)){ |
81bba717 |
463 | // Direct construction. |
7fd59977 |
464 | // --------------------- |
465 | |
7fd59977 |
466 | Standard_Integer bid; |
467 | TopAbs_Orientation ori = OFaCo; |
468 | TopAbs_Orientation oriS = st1->Orientation(IFaCo1); |
469 | TopAbs_Orientation OFF1 = FF1.Orientation(); |
470 | TopAbs_Orientation oriSFF1 = st1->Orientation(IFaArc1); |
471 | bid = 1; |
472 | bid = ChFi3d::NextSide(ori,OFF1,oriS,oriSFF1,bid); |
473 | TopAbs_Orientation op1,op2; |
474 | if(yapiv) bid = ChFi3d::ConcaveSide(BRS1,BRS2,pivot,op1,op2); |
475 | op1 = TopAbs::Reverse(op1); |
476 | op2 = TopAbs::Reverse(op2); |
477 | #ifdef DEB |
478 | ChFi3d_InitChron(ch);// init perf ChFiKPart_ComputeData |
479 | #endif |
480 | Standard_Real radius = |
481 | Handle(ChFiDS_FilSpine)::DownCast(st1->Spine())->Radius(); |
482 | done = ChFiKPart_ComputeData::ComputeCorner(DStr,coin,HFaCo,HBRS1,HBRS2, |
483 | OFaCo,ori,op1,op2,radius); |
484 | #ifdef DEB |
485 | ChFi3d_ResultChron(ch , t_chfikpartcompdata);//result perf ChFiKPart_ComputeData |
486 | #endif |
487 | } |
488 | else { |
81bba717 |
489 | // Construction by filling remplissage |
7fd59977 |
490 | // ---------------------------- |
491 | Standard_Real uPCArc1, uPCArc2; |
492 | gp_Pnt2d p2da1,p2df1,p2da2,p2df2,p2dfac1,p2dfac2; |
493 | gp_Vec2d v2dfac1,v2dfac2; |
494 | Handle(GeomFill_Boundary) B1,B2,Bpiv,Bfac; |
495 | uPCArc1 = sd1->Interference(IFaArc1).Parameter(isfirst1); |
496 | p2da1 = sd1->Interference(IFaArc1).PCurveOnSurf()->Value(uPCArc1); |
497 | p2df1 = sd1->Interference(IFaCo1).PCurveOnSurf()->Value(uPCArc1); |
498 | sd1->Interference(IFaCo1).PCurveOnFace()->D1(uPCArc1,p2dfac1,v2dfac1); |
499 | uPCArc2 = sd2->Interference(IFaArc2).Parameter(isfirst2); |
500 | p2da2 = sd2->Interference(IFaArc2).PCurveOnSurf()->Value(uPCArc2); |
501 | p2df2 = sd2->Interference(IFaCo2).PCurveOnSurf()->Value(uPCArc2); |
502 | sd2->Interference(IFaCo2).PCurveOnFace()->D1(uPCArc2,p2dfac2,v2dfac2); |
503 | #ifdef DEB |
81bba717 |
504 | ChFi3d_InitChron(ch ); // init perf filling |
7fd59977 |
505 | #endif |
506 | B1 = ChFi3d_mkbound(surf1,p2df1,p2da1,tolesp,2.e-4); |
507 | B2 = ChFi3d_mkbound(surf2,p2df2,p2da2,tolesp,2.e-4); |
508 | Handle(Geom2d_Curve) PCurveOnFace; |
509 | Bfac = ChFi3d_mkbound(HFaCo,PCurveOnFace,Sens1,p2dfac1,v2dfac1, |
510 | Sens2,p2dfac2,v2dfac2,tolesp,2.e-4); |
511 | GeomFill_ConstrainedFilling fil(8,20); |
512 | if(sameparam) { |
513 | fil.Init(Bfac,B2,B1,1); |
514 | } |
515 | else { |
516 | Handle(Adaptor3d_HCurve) HPivTrim = Hpivot->ChangeCurve(). |
517 | Trim(Min(parCP1,parCP2),Max(parCP1,parCP2),tolesp); |
518 | Bpiv = new GeomFill_SimpleBound(HPivTrim,tolesp,2.e-4); |
519 | fil.Init(Bfac,B2,Bpiv,B1,1); |
520 | BRepAdaptor_Curve2d pcpivot; |
521 | gp_Vec dArc,dcf; |
522 | gp_Pnt bidon; |
523 | Hpivot->D1(parCP1,bidon,dArc); |
524 | Standard_Real fb1,lb1; |
525 | B1->Bounds(fb1,lb1); |
526 | B1->D1(lb1,bidon,dcf); |
527 | Standard_Boolean pivotverslebas = dArc.Dot(dcf) <= 0.; |
528 | Standard_Boolean pcfalenvers = (parCP1 > parCP2); |
529 | if((pivotverslebas && !pcfalenvers)|| |
530 | (!pivotverslebas && pcfalenvers)) { |
531 | FaPiv = FF2; |
532 | HFaPiv = HBRS2; |
533 | resetcp2 = 1; |
534 | } |
535 | else { |
536 | FaPiv = FF1; |
537 | HFaPiv = HBRS1; |
538 | resetcp1 = 1; |
539 | } |
540 | FaPiv.Orientation(TopAbs_FORWARD); |
541 | pcpivot.Initialize(pivot,FaPiv); |
542 | TopExp_Explorer Expl; |
543 | for(Expl.Init(FaPiv,TopAbs_EDGE); Expl.More(); Expl.Next()){ |
544 | if(Expl.Current().IsSame(pivot)) { |
545 | pctrans = Expl.Current().Orientation(); |
546 | break; |
547 | } |
548 | } |
549 | if(pcpivot.GetType() != GeomAbs_BSplineCurve){ |
550 | Handle(Geom2d_TrimmedCurve) |
551 | trc = new Geom2d_TrimmedCurve(pcpivot.Curve(), |
552 | Min(parCP1,parCP2), |
553 | Max(parCP1,parCP2)); |
554 | PCurveOnPiv = Geom2dConvert::CurveToBSplineCurve(trc); |
555 | } |
556 | else { |
557 | PCurveOnPiv = Geom2dConvert::SplitBSplineCurve |
558 | (Handle(Geom2d_BSplineCurve)::DownCast(pcpivot.Curve()), |
559 | Min(parCP1,parCP2),Max(parCP1,parCP2),tol2d); |
560 | } |
561 | TColStd_Array1OfReal kk(1,PCurveOnPiv->NbKnots()); |
562 | PCurveOnPiv->Knots(kk); |
563 | BSplCLib::Reparametrize(0.,1.,kk); |
564 | PCurveOnPiv->SetKnots(kk); |
565 | if(pcfalenvers) { |
566 | PCurveOnPiv->Reverse(); |
567 | pctrans = TopAbs::Reverse(pctrans); |
568 | } |
569 | } |
570 | Handle(Geom_Surface) Surfcoin = fil.Surface(); |
571 | done = CompleteData(coin,Surfcoin, |
572 | HFaCo,PCurveOnFace, |
573 | HFaPiv,PCurveOnPiv,OFaCo,1, |
574 | 0,0,0,0); |
575 | #ifdef DEB |
81bba717 |
576 | ChFi3d_ResultChron(ch , t_remplissage);// result perf filling |
7fd59977 |
577 | #endif |
578 | } |
579 | #ifdef DEB |
81bba717 |
580 | ChFi3d_InitChron(ch); // init perf update DS |
7fd59977 |
581 | #endif |
582 | if (done){ |
81bba717 |
583 | // Update 3 CornerData and the DS |
7fd59977 |
584 | // ---------------------------------------- |
585 | if(resetcp1){ |
586 | gp_Pnt pjyl = CP1.Point(); |
587 | Standard_Real tolsav = CP1.Tolerance(); |
588 | CP1.Reset(); |
589 | CP1.SetPoint(pjyl); |
590 | CP1.SetTolerance(tolsav); |
591 | } |
592 | else if(resetcp2){ |
593 | gp_Pnt pjyl = CP2.Point(); |
594 | Standard_Real tolsav = CP2.Tolerance(); |
595 | CP2.Reset(); |
596 | CP2.SetPoint(pjyl); |
597 | CP2.SetTolerance(tolsav); |
598 | } |
599 | Standard_Real P1deb,P2deb,P1fin,P2fin; |
600 | Standard_Integer If1,If2,Il1,Il2,Icf,Icl; |
601 | const ChFiDS_CommonPoint& Pf1 = coin->VertexFirstOnS1(); |
602 | ChFiDS_CommonPoint& Pf2 = coin->ChangeVertexFirstOnS2(); |
603 | const ChFiDS_CommonPoint& Pl1 = coin->VertexLastOnS1(); |
604 | ChFiDS_CommonPoint& Pl2 = coin->ChangeVertexLastOnS2(); |
605 | Pf2 = CP1; |
606 | Pl2 = CP2; |
607 | |
81bba717 |
608 | // the corner to start, |
7fd59977 |
609 | // ----------------------- |
610 | ChFiDS_Regul regdeb, regfin; |
611 | If1 = ChFi3d_IndexPointInDS(Pf1,DStr); |
612 | If2 = ChFi3d_IndexPointInDS(Pf2,DStr); |
613 | Il1 = ChFi3d_IndexPointInDS(Pl1,DStr); |
614 | if(sameparam) Il2 = If2; |
615 | else Il2 = ChFi3d_IndexPointInDS(Pl2,DStr); |
616 | |
617 | gp_Pnt2d pp1,pp2; |
618 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
619 | Value(coin->InterferenceOnS1().FirstParameter()); |
620 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
621 | Value(coin->InterferenceOnS2().FirstParameter()); |
622 | Handle(Geom_Curve) C3d; |
623 | Standard_Real tolreached; |
624 | ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2, |
625 | DStr.Surface(coin->Surf()).Surface(),C3d, |
626 | corner->ChangeFirstPCurve(),P1deb,P2deb, |
627 | tolesp,tol2d,tolreached,0); |
628 | Standard_Real par1 = sd1->Interference(IFaArc1).Parameter(isfirst1); |
629 | pp1 = sd1->Interference(IFaCo1).PCurveOnSurf()->Value(par1); |
630 | pp2 = sd1->Interference(IFaArc1).PCurveOnSurf()->Value(par1); |
631 | Standard_Real tolr1; |
632 | ChFi3d_ComputePCurv(C3d,pp1,pp2,st1->ChangePCurve(isfirst1), |
633 | DStr.Surface(sd1->Surf()).Surface(), |
634 | P1deb,P2deb,tolesp,tolr1); |
635 | tolreached = Max(tolreached,tolr1); |
636 | TopOpeBRepDS_Curve Tcurv1(C3d,tolreached); |
637 | Icf = DStr.AddCurve(Tcurv1); |
638 | regdeb.SetCurve(Icf); |
639 | regdeb.SetS1(coin->Surf(),0); |
640 | regdeb.SetS2(sd1->Surf(),0); |
641 | myRegul.Append(regdeb); |
642 | corner->ChangeFirstCurve(Icf); |
643 | corner->ChangeFirstParameters(P1deb,P2deb); |
644 | corner->ChangeIndexFirstPointOnS1(If1); |
645 | corner->ChangeIndexFirstPointOnS2(If2); |
646 | |
647 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
648 | Value(coin->InterferenceOnS1().LastParameter()); |
649 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
650 | Value(coin->InterferenceOnS2().LastParameter()); |
651 | ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2, |
652 | DStr.Surface(coin->Surf()).Surface(),C3d, |
653 | corner->ChangeLastPCurve(),P1fin,P2fin, |
654 | tolesp,tol2d,tolreached,0); |
655 | Standard_Real par2 = sd2->Interference(IFaArc2).Parameter(isfirst2); |
656 | pp1 = sd2->Interference(IFaCo2).PCurveOnSurf()->Value(par2); |
657 | pp2 = sd2->Interference(IFaArc2).PCurveOnSurf()->Value(par2); |
658 | Standard_Real tolr2; |
659 | ChFi3d_ComputePCurv(C3d,pp1,pp2,st2->ChangePCurve(isfirst2), |
660 | DStr.Surface(sd2->Surf()).Surface(), |
661 | P1deb,P2deb,tolesp,tolr2); |
662 | tolreached = Max(tolreached,tolr2); |
663 | TopOpeBRepDS_Curve Tcurv2(C3d,tolreached); |
664 | Icl = DStr.AddCurve(Tcurv2); |
665 | regfin.SetCurve(Icl); |
666 | regfin.SetS1(coin->Surf(),0); |
667 | regfin.SetS2(sd2->Surf(),0); |
668 | myRegul.Append(regfin); |
669 | corner->ChangeLastCurve(Icl); |
670 | corner->ChangeLastParameters(P1fin,P2fin); |
671 | corner->ChangeIndexLastPointOnS1(Il1); |
672 | corner->ChangeIndexLastPointOnS2(Il2); |
673 | |
674 | coin->ChangeIndexOfS1(DStr.AddShape(FaCo)); |
675 | if(sameparam) coin->ChangeIndexOfS2(0); |
676 | else { |
677 | coin->ChangeIndexOfS2(DStr.AddShape(FaPiv)); |
678 | coin->ChangeInterferenceOnS2().SetTransition(pctrans); |
679 | } |
680 | corner->SetSolidIndex(st1->SolidIndex()); |
681 | |
81bba717 |
682 | // then the starting Stripe, |
7fd59977 |
683 | // ------------------------ |
684 | st1->SetCurve(Icf,isfirst1); |
685 | st1->SetIndexPoint(If1,isfirst1,IFaCo1); |
686 | st1->SetIndexPoint(If2,isfirst1,IFaArc1); |
687 | st1->SetParameters(isfirst1,P1deb,P2deb); |
688 | sd1->ChangeVertex(isfirst1,IFaCo1) = Pf1; |
689 | sd1->ChangeVertex(isfirst1,IFaArc1) = Pf2; |
690 | sd1->ChangeInterference(IFaCo1).SetParameter(par1,isfirst1); |
691 | if (IFaCo1 == 2) st1->SetOrientation(TopAbs_REVERSED,isfirst1); |
692 | |
81bba717 |
693 | // then the end Stripe, |
7fd59977 |
694 | // ------------------------- |
695 | st2->SetCurve(Icl,isfirst2); |
696 | st2->SetIndexPoint(Il1,isfirst2,IFaCo2); |
697 | st2->SetIndexPoint(Il2,isfirst2,IFaArc2); |
698 | st2->SetParameters(isfirst2,P1fin,P2fin); |
699 | sd2->ChangeVertex(isfirst2,IFaCo2) = Pl1; |
700 | sd2->ChangeVertex(isfirst2,IFaArc2) = Pl2; |
701 | sd2->ChangeInterference(IFaCo2).SetParameter(par2,isfirst2); |
702 | if (IFaCo2 == 2) st2->SetOrientation(TopAbs_REVERSED,isfirst2); |
703 | } |
704 | #ifdef DEB |
81bba717 |
705 | ChFi3d_ResultChron(ch , t_t2cornerDS);// result perf update DS |
7fd59977 |
706 | #endif |
707 | } |
708 | else { |
81bba717 |
709 | //it is necessary to make difference with |
7fd59977 |
710 | if(!OkinterCC) { |
81bba717 |
711 | Standard_Failure::Raise("TwoCorner : No intersection pc pc"); |
7fd59977 |
712 | } |
713 | Handle(ChFiDS_Stripe) stsam, stdif; |
714 | Handle(ChFiDS_SurfData) sdsam, sddif; |
715 | #ifndef DEB |
716 | Standard_Real uintpcsam = 0., uintpcdif = 0.; |
717 | Standard_Integer ifacosam = 0, ifacodif = 0, ifaopsam = 0, ifaopdif = 0; |
718 | Standard_Boolean isfirstsam = Standard_False, isfirstdif = Standard_False; |
719 | #else |
720 | Standard_Real uintpcsam, uintpcdif; |
721 | Standard_Integer ifacosam, ifacodif, ifaopsam, ifaopdif; |
722 | Standard_Boolean isfirstsam, isfirstdif; |
723 | #endif |
724 | if(Stat1 == ChFiDS_OnSame && Stat2 == ChFiDS_OnDiff){ |
725 | stsam = st1; sdsam = sd1; uintpcsam = UIntPC1; |
726 | ifacosam = IFaCo1; ifaopsam = IFaArc1; isfirstsam = isfirst1; |
727 | stdif = st2; sddif = sd2; uintpcdif = UIntPC2; |
728 | ifacodif = IFaCo2; ifaopdif = IFaArc2; isfirstdif = isfirst2; |
729 | } |
730 | else if(Stat1 == ChFiDS_OnDiff && Stat2 == ChFiDS_OnSame){ |
731 | stsam = st2; sdsam = sd2; uintpcsam = UIntPC2; |
732 | ifacosam = IFaCo2; ifaopsam = IFaArc2; isfirstsam = isfirst2; |
733 | stdif = st1; sddif = sd1; uintpcdif = UIntPC1; |
734 | ifacodif = IFaCo1; ifaopdif = IFaArc1; isfirstdif = isfirst1; |
735 | } |
736 | else { |
81bba717 |
737 | Standard_Failure::Raise("TwoCorner : Config unknown"); |
7fd59977 |
738 | } |
81bba717 |
739 | //It is checked if surface ondiff has a point on arc from the side opposed |
740 | //to the common face and if this arc is connected to the base face |
741 | //opposed to common face of the surface onsame. |
7fd59977 |
742 | ChFiDS_CommonPoint& cpopdif = sddif->ChangeVertex(isfirstdif,ifaopdif); |
743 | if(!cpopdif.IsOnArc()) { |
744 | Standard_Failure::Raise |
81bba717 |
745 | ("TwoCorner : No point on restriction on surface OnDiff"); |
7fd59977 |
746 | } |
747 | const TopoDS_Edge& Arcopdif = cpopdif.Arc(); |
748 | const TopoDS_Face& Fopsam = TopoDS::Face(DStr.Shape(sdsam->Index(ifaopsam))); |
749 | TopExp_Explorer ex; |
750 | for(ex.Init(Fopsam,TopAbs_EDGE); ex.More(); ex.Next()){ |
751 | if(ex.Current().IsSame(Arcopdif)) { |
752 | break; |
753 | } |
754 | else if(!ex.More()) { |
755 | Standard_Failure::Raise |
81bba717 |
756 | ("TwoCorner : No common face to loop the contour"); |
7fd59977 |
757 | } |
758 | } |
759 | #ifdef DEB |
81bba717 |
760 | ChFi3d_InitChron(ch ); // init perf filling |
7fd59977 |
761 | #endif |
762 | Handle(GeomFill_Boundary) Bsam,Bdif,Bfac; |
763 | gp_Pnt2d ppopsam = |
764 | sdsam->Interference(ifaopsam).PCurveOnSurf()->Value(uintpcsam); |
765 | gp_Pnt2d ppcosam = |
766 | sdsam->Interference(ifacosam).PCurveOnSurf()->Value(uintpcsam); |
767 | Handle(Geom_Surface) surfsam = DStr.Surface(sdsam->Surf()).Surface(); |
768 | Handle(GeomAdaptor_HSurface) Hsurfsam = new GeomAdaptor_HSurface(surfsam); |
769 | Handle(Geom2d_Curve) pcsurfsam; |
770 | Bsam = ChFi3d_mkbound(Hsurfsam,pcsurfsam,ppopsam,ppcosam,tolesp,2.e-4); |
771 | Standard_Real upcopdif = sddif->Interference(ifaopdif).Parameter(isfirstdif); |
772 | gp_Pnt2d ppopdif = |
773 | sddif->Interference(ifaopdif).PCurveOnSurf()->Value(upcopdif); |
774 | gp_Pnt2d ppcodif = |
775 | sddif->Interference(ifacodif).PCurveOnSurf()->Value(uintpcdif); |
776 | Handle(Geom_Surface) surfdif = DStr.Surface(sddif->Surf()).Surface(); |
777 | Handle(GeomAdaptor_HSurface) Hsurfdif = new GeomAdaptor_HSurface(surfdif); |
778 | Handle(Geom2d_Curve) pcsurfdif; |
779 | Bdif = ChFi3d_mkbound(Hsurfdif,pcsurfdif,ppcodif,ppopdif,tolesp,2.e-4); |
780 | gp_Pnt2d ppfacsam,ppfacdif; |
781 | gp_Pnt PPfacsam,PPfacdif; |
782 | gp_Vec VVfacsam,VVfacdif; |
783 | sdsam->Interference(ifaopsam).PCurveOnFace()->D0(uintpcsam,ppfacsam); |
784 | const Handle(Geom_Curve)& curvopsam = |
785 | DStr.Curve(sdsam->Interference(ifaopsam).LineIndex()).Curve(); |
786 | curvopsam->D1(uintpcsam,PPfacsam,VVfacsam); |
787 | BRepAdaptor_Curve2d PCArcFac(Arcopdif,Fopsam); |
788 | PCArcFac.D0(cpopdif.ParameterOnArc(),ppfacdif); |
789 | BRepAdaptor_Curve CArcFac(Arcopdif); |
790 | CArcFac.D1(cpopdif.ParameterOnArc(),PPfacdif,VVfacdif); |
791 | Handle(BRepAdaptor_HSurface) HBRFopsam = new BRepAdaptor_HSurface(); |
792 | BRepAdaptor_Surface& BRFopsam = HBRFopsam->ChangeSurface(); |
793 | BRFopsam.Initialize(Fopsam,Standard_False); |
794 | Handle(Geom2d_Curve) pcFopsam = ChFi3d_BuildPCurve(HBRFopsam, |
795 | ppfacsam,VVfacsam, |
796 | ppfacdif,VVfacdif,1); |
797 | Bfac = ChFi3d_mkbound(HBRFopsam,pcFopsam,tolesp,2.e-4); |
798 | GeomFill_ConstrainedFilling fil(8,20); |
799 | fil.Init(Bsam,Bdif,Bfac,1); |
800 | #if 0 |
801 | for(Standard_Integer ib = 0; ib < 4; ib++){ |
802 | if(ib == 2) continue; |
803 | fil.CheckCoonsAlgPatch(ib); |
804 | fil.CheckTgteField(ib); |
805 | fil.CheckApprox(ib); |
806 | fil.CheckResult(ib); |
807 | } |
808 | #endif |
809 | Handle(Geom_Surface) Surfcoin = fil.Surface(); |
810 | TopAbs_Orientation Osurfsam = sdsam->Orientation(); |
811 | Handle(Geom2d_Curve) pcnul; |
812 | done = CompleteData(coin,Surfcoin, |
813 | Hsurfsam,pcsurfsam, |
814 | HBRFopsam,pcnul,Osurfsam,1, |
815 | 0,0,0,0); |
816 | #ifdef DEB |
81bba717 |
817 | ChFi3d_ResultChron(ch , t_remplissage);// result perf filling |
7fd59977 |
818 | #endif |
81bba717 |
819 | if(!done) Standard_Failure::Raise("concavites inverted : fail"); |
7fd59977 |
820 | #ifdef DEB |
81bba717 |
821 | ChFi3d_InitChron(ch); // init perf update DS |
7fd59977 |
822 | #endif |
81bba717 |
823 | // Update 3 CornerData and the DS |
7fd59977 |
824 | // ---------------------------------------- |
81bba717 |
825 | // the corner to start, |
7fd59977 |
826 | // ----------------------- |
827 | Standard_Real P1deb,P2deb,P1fin,P2fin; |
828 | Standard_Integer If1,If2,Il1,Il2,Icf,Icl; |
829 | const ChFiDS_CommonPoint& Pf1 = coin->VertexFirstOnS1(); |
830 | ChFiDS_CommonPoint& Pf2 = coin->ChangeVertexFirstOnS2(); |
831 | const ChFiDS_CommonPoint& Pl1 = coin->VertexLastOnS1(); |
832 | ChFiDS_CommonPoint& Pl2 = coin->ChangeVertexLastOnS2(); |
833 | Pf2 = Pl2 = cpopdif; |
834 | |
835 | ChFiDS_Regul regdeb, regfin; |
836 | If1 = ChFi3d_IndexPointInDS(Pf1,DStr); |
837 | If2 = ChFi3d_IndexPointInDS(Pf2,DStr); |
838 | Il1 = ChFi3d_IndexPointInDS(Pl1,DStr); |
839 | Il2 = If2; |
840 | |
841 | gp_Pnt2d pp1,pp2; |
842 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
843 | Value(coin->InterferenceOnS1().FirstParameter()); |
844 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
845 | Value(coin->InterferenceOnS2().FirstParameter()); |
846 | Handle(Geom_Curve) C3d; |
847 | Standard_Real tolreached; |
848 | ChFi3d_ComputeArete(Pf1,pp1,Pf2,pp2, |
849 | DStr.Surface(coin->Surf()).Surface(),C3d, |
850 | corner->ChangeFirstPCurve(),P1deb,P2deb, |
851 | tolesp,tol2d,tolreached,0); |
852 | Standard_Real tolr1; |
853 | Handle(GeomAdaptor_HCurve) HC3d = new GeomAdaptor_HCurve(C3d); |
854 | ChFi3d_SameParameter(HC3d,pcFopsam,HBRFopsam,tolesp,tolr1); |
855 | tolreached = Max(tolreached,tolr1); |
856 | TopOpeBRepDS_Curve Tcurv1(C3d,tolreached); |
857 | Icf = DStr.AddCurve(Tcurv1); |
81bba717 |
858 | // place the pcurve on face in the DS |
7fd59977 |
859 | TopAbs_Orientation OpcFopsam = sdsam->Interference(ifaopsam).Transition(); |
860 | Standard_Integer IFopsam = sdsam->Index(ifaopsam); |
861 | if(isfirstsam) OpcFopsam = TopAbs::Reverse(OpcFopsam); |
862 | Handle(TopOpeBRepDS_SurfaceCurveInterference) |
863 | interf = ChFi3d_FilCurveInDS(Icf,IFopsam,pcFopsam,OpcFopsam); |
864 | DStr.ChangeShapeInterferences(IFopsam).Append(interf); |
865 | |
866 | regdeb.SetCurve(Icf); |
867 | regdeb.SetS1(coin->Surf(),0); |
868 | regdeb.SetS2(IFopsam,1); |
869 | myRegul.Append(regdeb); |
870 | corner->ChangeFirstCurve(Icf); |
871 | corner->ChangeFirstParameters(P1deb,P2deb); |
872 | corner->ChangeIndexFirstPointOnS1(If1); |
873 | corner->ChangeIndexFirstPointOnS2(If2); |
874 | |
875 | pp1 = coin->InterferenceOnS1().PCurveOnSurf()-> |
876 | Value(coin->InterferenceOnS1().LastParameter()); |
877 | pp2 = coin->InterferenceOnS2().PCurveOnSurf()-> |
878 | Value(coin->InterferenceOnS2().LastParameter()); |
879 | ChFi3d_ComputeArete(Pl1,pp1,Pl2,pp2, |
880 | DStr.Surface(coin->Surf()).Surface(),C3d, |
881 | corner->ChangeLastPCurve(),P1fin,P2fin, |
882 | tolesp,tol2d,tolreached,0); |
883 | Standard_Real tolr2; |
884 | HC3d->ChangeCurve().Load(C3d); |
885 | ChFi3d_SameParameter(HC3d,pcsurfdif,Hsurfdif,tolesp,tolr2); |
886 | tolreached = Max(tolreached,tolr2); |
887 | TopOpeBRepDS_Curve Tcurv2(C3d,tolreached); |
888 | Icl = DStr.AddCurve(Tcurv2); |
889 | regfin.SetCurve(Icl); |
890 | regfin.SetS1(coin->Surf(),0); |
891 | regfin.SetS2(sddif->Surf(),0); |
892 | myRegul.Append(regfin); |
893 | corner->ChangeLastCurve(Icl); |
894 | corner->ChangeLastParameters(P1fin,P2fin); |
895 | corner->ChangeIndexLastPointOnS1(Il1); |
896 | corner->ChangeIndexLastPointOnS2(Il2); |
897 | |
898 | coin->ChangeIndexOfS1(-sdsam->Surf()); |
899 | coin->ChangeIndexOfS2(0); |
900 | |
901 | corner->SetSolidIndex(stsam->SolidIndex()); |
902 | |
81bba717 |
903 | // then Stripe OnSame |
7fd59977 |
904 | // --------------------- |
905 | const ChFiDS_FaceInterference& intcoin1 = coin->InterferenceOnS1(); |
906 | stsam->SetCurve(intcoin1.LineIndex(),isfirstsam); |
81bba717 |
907 | stsam->InDS(isfirstsam); // filDS already works from the corner. |
7fd59977 |
908 | stsam->ChangePCurve(isfirstsam) = coin->InterferenceOnS1().PCurveOnFace(); |
909 | stsam->SetIndexPoint(If1,isfirstsam,ifaopsam); |
910 | stsam->SetIndexPoint(Il1,isfirstsam,ifacosam); |
911 | stsam->SetParameters(isfirstsam, |
912 | intcoin1.FirstParameter(), |
913 | intcoin1.LastParameter()); |
914 | sdsam->ChangeVertex(isfirstsam,ifaopsam) = Pf1; |
915 | sdsam->ChangeVertex(isfirstsam,ifacosam) = Pl1; |
916 | sdsam->ChangeInterferenceOnS1().SetParameter(uintpcsam,isfirstsam); |
917 | sdsam->ChangeInterferenceOnS2().SetParameter(uintpcsam,isfirstsam); |
918 | if (ifaopsam == 2) stsam->SetOrientation(TopAbs_REVERSED,isfirstsam); |
919 | |
81bba717 |
920 | // then Stripe OnDiff |
7fd59977 |
921 | // --------------------- |
922 | stdif->SetCurve(Icl,isfirstdif); |
923 | stdif->ChangePCurve(isfirstdif) = pcsurfdif; |
924 | stdif->SetIndexPoint(Il2,isfirstdif,ifaopdif); |
925 | stdif->SetIndexPoint(Il1,isfirstdif,ifacodif); |
926 | stdif->SetParameters(isfirstdif,P1fin,P2fin); |
927 | sddif->ChangeVertex(isfirstdif,ifaopdif) = Pl2; |
928 | sddif->ChangeVertex(isfirstdif,ifacodif) = Pl1; |
929 | sddif->ChangeInterference(ifacodif).SetParameter(uintpcdif,isfirstdif); |
930 | if (ifaopdif == 1) stdif->SetOrientation(TopAbs_REVERSED,isfirstdif); |
931 | #ifdef DEB |
81bba717 |
932 | ChFi3d_ResultChron(ch , t_t2cornerDS);// result perf update DS |
7fd59977 |
933 | #endif |
934 | } |
935 | if(!myEVIMap.IsBound(Vtx)){ |
936 | TColStd_ListOfInteger li; |
937 | myEVIMap.Bind(Vtx,li); |
938 | } |
939 | myEVIMap.ChangeFind(Vtx).Append(coin->Surf()); |
940 | myListStripe.Append(corner); |
941 | } |
942 | } |
943 | |