1 // Created on: 1994-02-17
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <TopOpeBRep_FacesFiller.ixx>
19 #include <BRep_Tool.hxx>
22 #include <Standard_CString.hxx>
23 #include <BRepTools.hxx>
24 #include <Precision.hxx>
25 #include <TColStd_ListOfInteger.hxx>
26 #include <TColStd_ListIteratorOfListOfInteger.hxx>
28 #include <TopOpeBRep_FFDumper.hxx>
29 #include <TopOpeBRepTool_TOOL.hxx>
30 #include <TopOpeBRepTool_defineG.hxx>
31 #include <TopOpeBRepTool_EXPORT.hxx>
32 #include <TopOpeBRepTool_makeTransition.hxx>
34 #include <TopOpeBRepDS_Dumper.hxx>
35 #include <TopOpeBRepDS_InterferenceTool.hxx>
36 #include <TopOpeBRepDS_Curve.hxx>
37 #include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
39 #include <TopOpeBRep.hxx>
40 #include <TopOpeBRep_FFTransitionTool.hxx>
41 #include <TopOpeBRep_GeomTool.hxx>
42 #include <TopOpeBRep_PointGeomTool.hxx>
43 #include <TopOpeBRep_FFDumper.hxx>
45 #include <TopOpeBRep_define.hxx>
47 #include <Bnd_Box.hxx>
48 #include <BndLib_Add3dCurve.hxx>
51 #include <TopOpeBRep_DRAW.hxx>
55 Standard_EXPORT void debrest(const Standard_Integer i) {cout<<"+ debrest "<<i<<endl;}
56 Standard_EXPORT void debrline() {cout<<"+ debrline"<<endl;}
58 extern Standard_Boolean TopOpeBRepDS_GettraceCX(const Standard_Integer i);
59 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer i);
60 extern Standard_Boolean TopOpeBRepDS_GettraceSTRANGE();
61 extern Standard_Boolean TopOpeBRepDS_GettraceISTO();
62 extern Standard_Boolean TopOpeBRepDS_GettraceDSP();
63 extern Standard_Boolean TopOpeBRepDS_GettraceDSF();
64 extern Standard_Boolean TopOpeBRepDS_GettraceDSFK();
65 extern Standard_Boolean TopOpeBRepDS_GettraceDSNC();
66 extern Standard_Boolean TopOpeBRepDS_GettraceDSLT();
67 extern Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer a,Standard_Integer b,Standard_Integer c,Standard_Integer d,Standard_Integer e);
68 extern Standard_Boolean GLOBAL_bvpr;
69 extern void debvprmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il,Standard_Integer vp,Standard_Integer si);
70 extern Standard_Boolean TopOpeBRep_GetcontextNOPUNK();
73 static void FUN_traceRLine(const TopOpeBRep_LineInter& L)
76 TCollection_AsciiString ee("Edofline"); ee.Cat(L.Index()); char* eee = ee.ToCString();
77 DBRep::Set(eee,L.Arc());
81 static void FUN_traceRLine(const TopOpeBRep_LineInter&)
88 static void FUN_traceGLine(const TopOpeBRep_LineInter& L)
90 static void FUN_traceGLine(const TopOpeBRep_LineInter&)
94 TCollection_AsciiString ll("Glineof"); ll.Cat(L.Index()); char* lll = ll.ToCString();
95 Handle(Geom_Curve) c = L.Curve();
96 Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
97 Standard_Real par1 = L.VPoint(iINON1).ParameterOnLine();
98 Standard_Real parn = L.VPoint(iINONn).ParameterOnLine();
99 Standard_Boolean isperiodic = L.IsPeriodic();
100 Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(c,par1,parn,Standard_True);
101 DrawTrSurf::Set(lll,tc);
106 #define M_FORWARD(o) (o == TopAbs_FORWARD)
107 #define M_REVERSED(o) (o == TopAbs_REVERSED)
115 Standard_EXPORT void FUN_GetdgData(TopOpeBRepDS_PDataStructure& pDS,const TopOpeBRep_LineInter& L,
116 const TopoDS_Face& F1,const TopoDS_Face& F2, TopTools_DataMapOfShapeListOfShape& datamap);
117 Standard_EXPORT void FUN_FillVof12(const TopOpeBRep_LineInter& L,TopOpeBRepDS_PDataStructure pDS);
119 #define M_FINDVP (0) // only look for new vp
120 #define M_MKNEWVP (1) // only make newvp
121 #define M_GETVP (2) // steps (0) [+(1) if (O) fails]
122 Standard_EXPORT void FUN_VPIndex(TopOpeBRep_FacesFiller& FF,
123 const TopOpeBRep_LineInter& L,
124 const TopOpeBRep_VPointInter& VP,
125 const Standard_Integer ShapeIndex,
126 const Handle(TopOpeBRepDS_HDataStructure)& HDS,
127 const TopOpeBRepDS_ListOfInterference& DSCIL,
128 TopOpeBRepDS_Kind& PVKind, Standard_Integer& PVIndex, // out
129 Standard_Boolean& EPIfound, Handle(TopOpeBRepDS_Interference)& IEPI, // out
130 Standard_Boolean& CPIfound, Handle(TopOpeBRepDS_Interference)& ICPI, // out
131 const Standard_Integer mkVP);
132 Standard_EXPORT Standard_Boolean FUN_newtransEdge(const Handle(TopOpeBRepDS_HDataStructure) HDS,
133 const TopOpeBRep_FacesFiller& FF,
134 const TopOpeBRep_LineInter& L,
135 const Standard_Boolean& Lonrest,
136 const TopOpeBRep_VPointInter& VP,
137 const TopOpeBRepDS_Kind PVKind, const Standard_Integer PVIndex,
138 const Standard_Integer& OOShapeIndex,
139 const TopoDS_Edge& edge, const TopTools_ListOfShape& ERL, TopOpeBRepDS_Transition& T);
140 #define M_INTERNAL(st) (st == TopAbs_INTERNAL)
143 static Standard_Boolean FUN_IwithsuppiS(const TopOpeBRepDS_ListOfInterference& loI, const Standard_Integer iS, TopOpeBRepDS_ListOfInterference& loIfound)
145 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
146 for (; it.More(); it.Next()) {const Handle(TopOpeBRepDS_Interference)& I = it.Value();
147 if (I->Support() == iS) loIfound.Append(I);}
148 Standard_Boolean ok = (loIfound.Extent() > 0);
151 static Standard_Boolean FUN_IwithsuppkS(const TopOpeBRepDS_ListOfInterference& loI, const TopOpeBRepDS_Kind& kS, TopOpeBRepDS_ListOfInterference& loIfound)
153 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
154 for (; it.More(); it.Next()) {const Handle(TopOpeBRepDS_Interference)& I = it.Value();
155 if (I->SupportType() == kS) loIfound.Append(I);}
156 Standard_Boolean ok = (loIfound.Extent() > 0);
159 static Standard_Boolean FUN_IwithToniS(const TopOpeBRepDS_ListOfInterference& loI, const Standard_Integer iS, TopOpeBRepDS_ListOfInterference& loIfound)
161 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
162 for (; it.More(); it.Next()) {const Handle(TopOpeBRepDS_Interference)& I = it.Value();
163 if (I->Transition().Index() == iS) loIfound.Append(I);}
164 Standard_Boolean ok = (loIfound.Extent() > 0);
167 static Standard_Boolean FUN_supponF(const TopOpeBRepDS_PDataStructure pDS,
168 const TopOpeBRepDS_ListOfInterference& loI, const Standard_Integer iF,
169 TopOpeBRepDS_ListOfInterference& lIsupponF, TColStd_ListOfInteger& losupp)
171 //<losupp> = list of support S / I in <loI> : I = (T,G,S = Edge on <F>);
172 Standard_Boolean ok = (0 < iF) && (iF <= pDS->NbShapes());
173 if (!ok) return Standard_False;
175 TopTools_IndexedMapOfShape MOOE; TopExp::MapShapes(pDS->Shape(iF),TopAbs_EDGE,MOOE);
176 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
177 for (; it.More(); it.Next()){
178 const Handle(TopOpeBRepDS_Interference)& I = it.Value(); Standard_Integer iS = I->Support();
179 TopOpeBRepDS_Kind skind = I->SupportType();
180 Standard_Boolean add = Standard_False;
181 if (skind == TopOpeBRepDS_EDGE) add = MOOE.Contains(pDS->Shape(iS));
182 if (add) {losupp.Append(iS); lIsupponF.Append(I);}
184 if (losupp.Extent() < 1) return Standard_False;
185 return Standard_True;
187 static Standard_Boolean FUN_IoflSsuppS(const TopOpeBRepDS_PDataStructure pDS,
188 const Standard_Integer iS,const TColStd_ListOfInteger& lShape,
189 TopOpeBRepDS_ListOfInterference& IsuppiS)
191 Standard_Boolean ok = Standard_False;
193 // I on E : I = (T, G, S=iS)
195 // looking for interferences attached to shapes of <lShape> with support <iS>
196 TColStd_ListIteratorOfListOfInteger iti(lShape);
197 for (; iti.More(); iti.Next()){
198 const TopOpeBRepDS_ListOfInterference& lI = pDS->ShapeInterferences(iti.Value());
199 ok = FUN_IwithsuppiS(lI,iS,IsuppiS);
204 //=======================================================================
206 // purpose : The compute of a transition edge/face given interferences
207 // attached to the edge (stored in the DS).
208 //=======================================================================
209 static Standard_Boolean FUN_findTF(const TopOpeBRepDS_PDataStructure pDS,
210 const Standard_Integer iE, const Standard_Integer, const Standard_Integer iOOF,
211 TopOpeBRepDS_Transition& TF)
213 Standard_Real factor = 0.5;
214 // ----------------------------------------------------------------------
215 // <Ifound> on <E> : Ifound = (T, S=OOF, G=POINT/VERTEX on <E>)
216 // (T, S=edge of OOF, G=POINT/VERTEX on <E>)
217 // ----------------------------------------------------------------------
220 TopOpeBRepDS_ListOfInterference lITonOOF;
221 Standard_Boolean ok = FUN_IwithToniS(pDS->ShapeInterferences(iE),iOOF,lITonOOF);
222 if (!ok) return Standard_False;
223 TopOpeBRepDS_ListOfInterference lITOOFskFACE;
224 Standard_Boolean found = FUN_IwithsuppkS(lITonOOF,TopOpeBRepDS_FACE,lITOOFskFACE);
226 // NYI : a deeper analysis is needed, for the moment, we make the following
227 // prequesitory : transition on E of F on point of ES is valid for
228 // all the ES (here restriction) ie :
229 // TF : transition face(F) / face(OOF) on G = ES =
230 // TE : transition edge(E) / face(OOF) at G = POINT/VERTEX
231 //Ifound on <E> : Ifound = (T(on face OOF), S=FACE, G=POINT/VERTEX on <E>)
232 const Handle(TopOpeBRepDS_Interference)& Ifound = lITOOFskFACE.First();
233 TF = Ifound->Transition();
236 Standard_Boolean done = Standard_False;
237 TopOpeBRepDS_ListOfInterference lITOOFskEDGE;
238 if (!found) done = FUN_IwithsuppkS(lITonOOF,TopOpeBRepDS_EDGE,lITOOFskEDGE);
240 // Ifound on <E> : Ifound = (T(on face OOF), S=FACE, G=POINT/VERTEX on <E>)
241 // if <Ifound> found : compute TE at G / <OOF>.
243 const Handle(TopOpeBRepDS_Interference)& Ifound = lITOOFskEDGE.First();
244 const TopoDS_Edge& OOE = TopoDS::Edge(pDS->Shape(Ifound->Support()));
245 Standard_Real paronE; Standard_Boolean OOdone = FDS_Parameter(Ifound,paronE);
246 if (!OOdone) return Standard_False;
248 const TopoDS_Edge& E = TopoDS::Edge(pDS->Shape(iE));
249 const TopoDS_Face& OOF = TopoDS::Face(pDS->Shape(iOOF));
251 Standard_Real f,l; FUN_tool_bounds(E,f,l);
252 TopOpeBRepTool_makeTransition MKT;
254 Standard_Boolean OOEboundOOF = FUN_tool_EboundF(OOE,OOF);
255 Standard_Boolean iscl = TopOpeBRepTool_TOOL::IsClosingE(OOE,OOF);
256 if (OOEboundOOF && (!iscl)) {
257 Standard_Real oopar; Standard_Boolean ok1 = FUN_tool_parE(E,paronE,OOE,oopar);
258 if (!ok1) return Standard_False;
259 gp_Pnt2d uv; ok1 = FUN_tool_paronEF(OOE,oopar,OOF,uv);
260 if (!ok1) return Standard_False;
262 ok = MKT.Initialize(E,f,l,paronE, OOF,uv, factor);
263 if (ok) ok = MKT.SetRest(OOE,oopar);
266 gp_Pnt2d uv; Standard_Boolean ok1 = FUN_tool_parF(E,paronE,OOF,uv);
267 if (!ok1) return Standard_False;
269 ok = MKT.Initialize(E,f,l,paronE, OOF,uv, factor);
271 TopAbs_State stb,sta; ok = MKT.MkTonE(stb,sta);
272 if (!ok) return Standard_False;
273 TF.Before(stb); TF.After(sta);
274 return Standard_True;
280 static Standard_Boolean FUN_findTOOF(const TopOpeBRepDS_PDataStructure pDS,
281 const Standard_Integer iE, const Standard_Integer iF, const Standard_Integer iOOF,
282 TopOpeBRepDS_Transition& TOOF)
284 Standard_Real factor = 0.5;
286 // ----------------------------------------------------------------------
289 // <OOIfound> on <OOE> : OOIfound = (T, S=iF, G=POINT/VERTEX on <E>)
290 // ----------------------------------------------------------------------
292 // <lIsuppOOE> = list of interferences attached to <E> of support S = edge of <OOF>
293 // <liOOE> = list of supports of <lIsuppOOE>.
294 const TopOpeBRepDS_ListOfInterference& loIE = pDS->ShapeInterferences(iE);
295 TopOpeBRepDS_ListOfInterference lITonOOF; Standard_Boolean ok = FUN_IwithToniS(loIE,iOOF,lITonOOF);
296 TopOpeBRepDS_ListOfInterference lIsuppOOE;
297 TColStd_ListOfInteger liOOEGonE;
299 ok = FUN_IwithsuppkS(lITonOOF,TopOpeBRepDS_EDGE,lIsuppOOE);
300 if (ok) {TopOpeBRepDS_ListIteratorOfListOfInterference it(lIsuppOOE);
301 for (; it.More(); it.Next()) liOOEGonE.Append(it.Value()->Support());}
303 else ok = FUN_supponF(pDS,loIE,iOOF,lIsuppOOE,liOOEGonE);
304 if (!ok) return Standard_False;
306 // TopAbs_Orientation oritransOOE;
308 // <lOOIfound> = list of I attached to shapes of <liOOE> /
309 // I = (T, S=F, G=POINT/VERTEX on <E>)
310 TopOpeBRepDS_ListOfInterference lIOOEsuppFGonE;
311 Standard_Boolean OOfound = FUN_IoflSsuppS(pDS,iF,liOOEGonE,lIOOEsuppFGonE);
313 // NYI : a deeper analysis is needed, for the moment, we make the following
314 // prequesitory : transition on OOE of OOF on point of ES is valid for
315 // all the ES (here restriction) ie :
316 // TOOF : transition face(OOF) / face(F) on (G == ES)
317 // <=> TOOE : transition edge(OOE) / face(F) at G = POINT/VERTEX
318 const Handle(TopOpeBRepDS_Interference)& OOIfound = lIOOEsuppFGonE.First();
319 TOOF = OOIfound->Transition();
322 Standard_Boolean OOdone = Standard_False;
324 // Ifound on <E> : Ifound = (T, S=EDGE on <OOF>, G=POINT/VERTEX on <E>)
325 // if <Ifound> found : compute TOOE at G / <F>
327 const Handle(TopOpeBRepDS_Interference)& Ifound = lIsuppOOE.First();
328 const TopoDS_Edge& OOE = TopoDS::Edge(pDS->Shape(Ifound->Support()));
329 Standard_Real paronE; OOdone = FDS_Parameter(Ifound,paronE);
330 if (!OOdone) return Standard_False;
332 const TopoDS_Edge& E = TopoDS::Edge(pDS->Shape(iE));
333 const TopoDS_Face& F = TopoDS::Face(pDS->Shape(iF));
335 Standard_Real oopar; Standard_Boolean ok1 = FUN_tool_parE(E,paronE,OOE,oopar);
336 if (!ok1) return Standard_False;
337 gp_Pnt2d uv; ok1 = FUN_tool_paronEF(E,paronE,F,uv);
338 if (!ok1) return Standard_False;
339 Standard_Real f,l; FUN_tool_bounds(OOE,f,l);
341 TopAbs_State stb = TopAbs_UNKNOWN,sta = TopAbs_UNKNOWN;
342 TopOpeBRepTool_makeTransition MKT;
343 OOdone = MKT.Initialize(OOE,f,l,oopar,F,uv,factor);
344 if (OOdone) OOdone = MKT.SetRest(E,paronE);
345 if (OOdone) OOdone = MKT.MkTonE(stb,sta);
346 if (OOdone) {TOOF.Before(stb); TOOF.After(sta);}
348 ok = OOfound || OOdone;
352 Standard_EXPORT Standard_Boolean GLOBAL_btcx = Standard_False;void debtcx(){};
353 Standard_EXPORT void debtcxmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il)
354 {cout<<"f1,f2,il : "<<f1<<","<<f2<<","<<il<<endl;cout.flush();debtcx();}
356 //=======================================================================
357 //function : ProcessLine
359 //=======================================================================
360 void TopOpeBRep_FacesFiller::ProcessLine()
362 Standard_Boolean reject = ( !myLineOK || myLine==NULL );
367 Standard_Integer ili = myLine->Index(),nli = myFacesIntersector->NbLines();
368 Standard_Boolean tcx = TopOpeBRepDS_GettraceCX(ili);
369 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
370 Standard_Boolean traceDSNC = TopOpeBRepDS_GettraceDSNC();
371 if(tDSF)cout<<"trc tnvp 1 "<<myexF1<<" "<<myexF2<<" "<<ili<<endl;
372 if (tDSF||tcx) myHFFD->DumpLine(*myLine);
373 if (traceDSNC) cout<<"line "<<ili<<"/"<<nli<<endl;
376 Standard_Boolean HasVPonR = myLine->HasVPonR();
377 if (HasVPonR) FillLineVPonR();
380 Standard_Boolean inl = myLine->INL();
383 myHDS->SortOnParameter(myDSCIL);
386 TopOpeBRepDS_Dumper Dumper(myHDS);
387 if (tDSF||traceDSNC) Dumper.DumpLOI(myDSCIL,cout,"current curve : ");
393 //=======================================================================
394 //function : ResetDSC
396 //=======================================================================
397 void TopOpeBRep_FacesFiller::ResetDSC()
403 //=======================================================================
404 //function : ProcessVPInotonR
405 //purpose : Same as ProcessVPnotonR.
406 //=======================================================================
407 void TopOpeBRep_FacesFiller::ProcessVPInotonR(TopOpeBRep_VPointInterIterator& VPI)
409 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
413 //=======================================================================
414 //function : ProcessVPnotonR
416 //=======================================================================
417 void TopOpeBRep_FacesFiller::ProcessVPnotonR(const TopOpeBRep_VPointInter& VP)
420 Standard_Boolean traceDSF = TopOpeBRepDS_GettraceDSF();
421 Standard_Boolean traceDSP = TopOpeBRepDS_GettraceDSP();
422 Standard_Boolean traceISTO = TopOpeBRepDS_GettraceISTO();
423 if (traceDSF) cout<<endl;
426 Standard_Integer ShapeIndex = 0;
427 Standard_Integer iVP = VP.Index();
430 Standard_Integer ili=myLine->Index(),ivp=iVP,isi=ShapeIndex;
431 if(traceDSF || traceDSP){
432 cout<<"trc tnvp 1 "<<myexF1<<" "<<myexF2<<" "<<ili<<" "<<ivp<<" "<<isi;
433 cout<<"; # VPonR "<<iVP<<" on "<<ShapeIndex<<endl;
436 cout<<"f1,f2,l,vp,si : ";
437 cout<<myexF1<<","<<myexF2<<","<<ili<<","<<ivp<<","<<isi<<endl;
439 GLOBAL_bvpr = TopOpeBRep_GettraceNVP(myexF1,myexF2,ili,ivp,isi);
440 if (GLOBAL_bvpr) debvprmess(myexF1,myexF2,ili,ivp,isi);
443 Standard_Integer iINON1,iINONn,nINON;
444 myLine->VPBounds(iINON1,iINONn,nINON);
445 TopOpeBRepDS_ListIteratorOfListOfInterference itCPIL(myDSCIL);
447 TopOpeBRepDS_Kind PVKind; Standard_Integer PVIndex;
448 Standard_Boolean CPIfound = GetGeometry(itCPIL,VP,PVIndex,PVKind);
450 if (iVP != iINON1 && iVP != iINONn) {
451 #ifdef TOPOPEBREP_DEB
452 cout<<"VP "<<iVP<<" on "<<0<<" : point d'intersection anormal : rejet"<<endl;
459 Standard_Boolean found = GetFFGeometry(VP,PVKind,PVIndex);
460 if ( ! found ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
463 TopOpeBRepDS_Transition transLine;
465 const Handle(TopOpeBRepDS_Interference)& I = itCPIL.Value();
466 const TopOpeBRepDS_Transition& TI = I->Transition();
467 transLine = TI.Complement();
470 if (iVP == iINON1) transLine.Set(TopAbs_FORWARD);
471 else if (iVP == iINONn) transLine.Set(TopAbs_REVERSED);
474 Standard_Real parline = VP.ParameterOnLine();
475 Handle(TopOpeBRepDS_Interference) CPI = TopOpeBRepDS_InterferenceTool::MakeCurveInterference
476 (transLine,TopOpeBRepDS_CURVE,0,PVKind,PVIndex,parline);
477 StoreCurveInterference(CPI);
481 //=======================================================================
482 //function : ProcessVPR
484 //=======================================================================
485 void TopOpeBRep_FacesFiller::ProcessVPR(TopOpeBRep_FacesFiller& FF,const TopOpeBRep_VPointInter& VP)
487 TopOpeBRepDS_Transition LineTonF1 = FaceFaceTransition(1);
488 TopOpeBRepDS_Transition LineTonF2 = FaceFaceTransition(2);
489 TopoDS_Face F1 = myF1;
490 TopoDS_Face F2 = myF2;
491 // --- check interiority of VPoint to the restrictions
492 Standard_Boolean tokeep = VP.Keep();
493 if ( !tokeep ) return;
495 Standard_Integer ShapeIndex = VP.ShapeIndex();
497 if (ShapeIndex == 0) {
498 FF.ProcessVPnotonR(VP);
500 else if (ShapeIndex == 1) {
501 FF.ProcessVPonR(VP,LineTonF1,F1,1);
503 else if (ShapeIndex == 2) {
504 FF.ProcessVPonR(VP,LineTonF2,F2,2);
506 else if (ShapeIndex == 3) {
508 Standard_Boolean isV1 = VP.IsVertexOnS1();
509 Standard_Boolean isV2 = VP.IsVertexOnS2();
511 Standard_Integer shin1 = 1;
512 if (isV2 && !isV1) shin1 = 2;
515 FF.ProcessVPonR(VP,LineTonF1,F1,1);
516 FF.ProcessVPonR(VP,LineTonF2,F2,2);
518 else if (shin1 == 2) {
519 FF.ProcessVPonR(VP,LineTonF2,F2,2);
520 FF.ProcessVPonR(VP,LineTonF1,F1,1);
525 static Standard_Boolean FUN_brep_ONfirstP(const TopOpeBRep_VPointInter& vpf, const TopOpeBRep_VPointInter& VP)
526 // prequesitory : gline is on edge
528 Standard_Real parfirst = vpf.ParameterOnLine();
529 Standard_Real parcur = VP.ParameterOnLine();
530 Standard_Real d = parcur - parfirst;
531 Standard_Real tol = Precision::Confusion(); //nyixpu051098 : see lbr...
532 Standard_Boolean ONfirstP = (Abs(d) < tol);
536 //=======================================================================
537 //function : ProcessRLine
539 //=======================================================================
540 void TopOpeBRep_FacesFiller::ProcessRLine()
543 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
546 if (myLine->TypeLineCurve() != TopOpeBRep_RESTRICTION) {return;}
548 Standard_Boolean addIFE = Standard_True;
551 const TopoDS_Edge& Erest = TopoDS::Edge(myLine->Arc());
552 Standard_Boolean FIisrest = myFacesIntersector->IsRestriction(Erest);
553 if (!FIisrest) return;
555 Standard_Boolean isedge1 = myLine->ArcIsEdge(1);
556 Standard_Boolean isedge2 = myLine->ArcIsEdge(2);
557 Standard_Integer EShapeIndex = (isedge1) ? 1 : (isedge2) ? 2 : 0;
559 Standard_Integer iErest = myDS->AddShape(Erest,EShapeIndex);
560 Standard_Integer rank = myDS->AncestorRank(iErest);
561 Standard_Integer OOrank = (rank == 1)? 2: 1;
564 if (tDSF) {cout<<"+ edge restriction "<<myDS->SectionEdge(Erest);
565 cout<<" (DS "<<iErest<<")"<<endl;}
566 Standard_Boolean trce = TopOpeBRepDS_GettraceSPSX(iErest); if(trce) debrest(iErest);
569 Standard_Integer iF1 = myDS->AddShape(myF1,1);
570 Standard_Integer iF2 = myDS->AddShape(myF2,2);
571 Handle(TopOpeBRepDS_Interference) IFE;
573 TopOpeBRepDS_Transition T1 = FaceFaceTransition(1); T1.Index(iF2);
574 TopOpeBRepDS_Transition T2 = FaceFaceTransition(2); T2.Index(iF1);
576 Standard_Boolean T1unk = T1.IsUnknown();
577 Standard_Boolean T2unk = T2.IsUnknown();
578 Standard_Boolean processUNK = Standard_False;
580 Standard_Boolean nopunk = TopOpeBRep_GetcontextNOPUNK();
581 if (nopunk) processUNK = Standard_False;
583 if (processUNK && (T1unk || T2unk)) {
585 Standard_Boolean trc = TopOpeBRepDS_GettraceSTRANGE(); trc = trc || tDSF;
586 if (trc) cout<<"T UNKNOWN FEI F"<<iF1<<" F"<<iF2<<" on Erest"<<iErest<<endl;
588 TopoDS_Shape F = (*this).Face(rank); Standard_Integer iF = myDS->Shape(F);
589 TopoDS_Shape OOF = (*this).Face(OOrank); Standard_Integer iOOF = myDS->Shape(OOF);
590 Standard_Boolean findTOOF = (T1unk && (OOrank == 1)) || (T2unk && (OOrank == 2));
591 Standard_Boolean findTF = (T1unk && (rank == 1)) || (T2unk && (rank == 2));
596 // ?<OOIfound> on <OOE> : OOIfound = (T, S=iF, G=POINT/VERTEX on <Erest>)
597 TopOpeBRepDS_Transition T; Standard_Boolean OOTok = FUN_findTOOF(myDS,iErest,iF,iOOF,T);
599 if (OOrank == 1) FDS_SetT(T1,T);
603 cout<<"F"<<iOOF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
604 TopAbs::Print(T.After(),cout);cout<<" (F"<<iF<<") (E"<<iErest<<"))\n";
610 // ?Ifound on <Erest> : Ifound = (T on FACE=iOOF, S, G=POINT/VERTEX on <Erest>)
611 // if <Ifound> found : compute TErest at G / <OOF>
612 TopOpeBRepDS_Transition T; Standard_Boolean Tok = FUN_findTF(myDS,iErest,iF,iOOF,T);
614 if (rank == 1) FDS_SetT(T1,T);
617 if (trc) {cout<<"F"<<iF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
618 TopAbs::Print(T.After(),cout);cout<<" (F"<<iOOF<<") (E"<<iErest<<"))\n";}
622 T1unk = T1.IsUnknown();
623 T2unk = T2.IsUnknown();
624 } // processUNK && (T1unk || T2unk)
626 IFE = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference
627 (T1,iF2,iErest,isedge1,TopOpeBRepDS_UNSHGEOMETRY);
628 myHDS->StoreInterference(IFE,iF1);
630 IFE = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference
631 (T2,iF1,iErest,isedge2,TopOpeBRepDS_UNSHGEOMETRY);
632 myHDS->StoreInterference(IFE,iF2);
634 //#################### Rline Processing ####################
636 TopOpeBRep_VPointInterIterator VPI;
638 Standard_Real tola = Precision::Angular()*1.e5;//NYIXPUTOL
643 cout<<endl<<"------------ Rline processing --------------------"<<endl;
647 const TopOpeBRep_VPointInter& vpf = VPI.CurrentVP();
648 for (; VPI.More(); VPI.Next()) {
649 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
651 if (tDSF) {cout<<endl;myHFFD->DumpVP(VP);}
653 Standard_Integer absindex = VP.ShapeIndex(); // 0,1,2,3
654 Standard_Real parRest;
655 Standard_Boolean okR = VP.ParonE(Erest,parRest);
656 if (!okR) parRest = VP.ParameterOnLine();
657 Standard_Boolean on2edges = (absindex == 3) || (absindex == OOrank);
660 // MSV: treat the case when an edge is touched by interior of a face
662 // MSV: the commented code below leads to exception on 1cto 025 H3
663 // (object and tool have same subshapes), so to enable it
664 // the debug is needed
666 // Standard_Boolean SIisvertex = VP.IsVertex(EShapeIndex);
667 // if (SIisvertex) continue;
668 // Standard_Integer ShapeIndex = EShapeIndex;
669 // Standard_Integer OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
670 // TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
671 // Standard_Integer iOOFace = myDS->Shape(OOFace);
674 // TopOpeBRepDS_Kind PVKind = TopOpeBRepDS_POINT;
675 // Standard_Integer PVIndex = 0;
676 // Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False;
677 // Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
678 // FUN_VPIndex((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL,
679 // PVKind,PVIndex,EPIfound,IEPI,CPIfound,ICPI,
681 // Standard_Boolean Efound = (EPIfound || CPIfound);
682 // Standard_Boolean Ifound = (PVIndex != 0);
683 // Standard_Boolean condmake = (!Efound && !Ifound);
685 // PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
687 // // make transition on edge
688 // TopOpeBRepDS_Transition transEdge;
689 // TopOpeBRepDS_Transition Trans = FaceFaceTransition(ShapeIndex);
690 // Standard_Boolean TransUNK = Trans.IsUnknown();
692 // TopAbs_Orientation oriErest = Erest.Orientation();
693 // transEdge = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,ShapeIndex,oriErest);
694 // TransUNK = FDS_hasUNK(transEdge);
697 // Standard_Boolean ONfirstP = ::FUN_brep_ONfirstP(vpf,VP);
698 // TopAbs_Orientation OVP = ONfirstP ? TopAbs_FORWARD : TopAbs_REVERSED;
699 // transEdge.Set(OVP);
700 // if (ONfirstP) transEdge.StateAfter(TopAbs_ON);
701 // else transEdge.StateBefore(TopAbs_ON);
702 // TransUNK = FDS_hasUNK(transEdge);
704 // if (TransUNK) continue;
706 // // see if there is already such interference in DS
707 // TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);
708 // const TopOpeBRepDS_ListOfInterference& lIedge = myHDS->DS().ShapeInterferences(Erest);
709 // TopOpeBRepDS_ListOfInterference copy; FDS_copy(lIedge,copy);
710 // TopOpeBRepDS_ListOfInterference l1,l2;
711 // Standard_Integer nfound = FUN_selectGIinterference(copy,PVIndex,l1);
713 // if (iOOFace != 0) {
714 // TopOpeBRepDS_ListOfInterference l3,l4;
715 // nfound = FUN_selectITRASHAinterference(l2,iOOFace,l3);
716 // if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
717 // if (nfound) continue;
721 // // make and store interference
722 // Handle(TopOpeBRepDS_Interference) EPIf;
723 // if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
724 // TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
725 // EPIf = MakeEPVInterference(T,iOOFace,PVIndex,parRest,PVKind,
726 // TopOpeBRepDS_FACE,SIisvertex);
727 // myHDS->StoreInterference(EPIf,Erest);
732 TopoDS_Edge OOE = TopoDS::Edge(VP.Edge(OOrank));
733 Standard_Integer iOO = myDS->AddShape(OOE,OOrank);
736 VP.ParonE(OOE,OOpar);
738 // xpu091198 : 1d interf done in EdgesFiller processing (cto cylcong *)
739 Standard_Boolean sdmeds = FUN_ds_sdm((*myDS),Erest,OOE);
740 if (sdmeds) continue;
742 Standard_Integer obRest = TopOpeBRepTool_TOOL::OnBoundary(parRest,Erest); //vertex can be missed
743 Standard_Integer obOO = TopOpeBRepTool_TOOL::OnBoundary(OOpar,OOE); //vertex can be missed
745 if ((obRest == EXTERNAL)||(obOO == EXTERNAL)){
746 #ifdef TOPOPEBREP_DEB
747 if(obRest==EXTERNAL) cout<<"***********ProcessRLine : faulty parameter on Erest"<<endl;
748 if(obOO==EXTERNAL) cout<<"***********ProcessRLine : faulty parameter on OOE"<<endl;
752 Standard_Boolean tgeds = FUN_tool_EtgOOE(parRest,Erest, OOpar,OOE, tola);
754 TopOpeBRepDS_Kind PVKind = TopOpeBRepDS_POINT; Standard_Integer PVIndex = 0; // POINT or VERTEX index
756 for (Standard_Integer ShapeIndex = 1; ShapeIndex<=2; ShapeIndex++) {
757 Standard_Integer OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
758 Standard_Boolean SIErest = (ShapeIndex == rank);
760 Standard_Boolean SIisvertex = VP.IsVertex(ShapeIndex);
761 Standard_Boolean OOisvertex = VP.IsVertex(OOShapeIndex);
762 TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
763 Standard_Integer iOOFace = myDS->Shape(OOFace);
765 TopoDS_Edge edge,OOedge; Standard_Integer SIedgeIndex,OOedgeIndex;
766 Standard_Real paredge,OOparedge;
767 Standard_Integer onbound;
769 {edge = Erest; SIedgeIndex = iErest; paredge = parRest; onbound = obRest;
770 OOedge = OOE; OOedgeIndex = iOO; OOparedge = OOpar;}
772 {OOedge = Erest;OOedgeIndex = iErest; OOparedge = parRest; onbound = obOO;
773 edge = OOE; SIedgeIndex = iOO; paredge = OOpar;}
777 // xpu150399 : BUC60382
778 Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False; Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
779 ProcessVPondgE(VP, ShapeIndex,
780 PVKind,PVIndex, // out
781 EPIfound,IEPI, // out
782 CPIfound,ICPI); // out
785 // Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False; Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
786 FUN_VPIndex((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL,
787 PVKind,PVIndex,EPIfound,IEPI,CPIfound,ICPI,
789 Standard_Boolean Efound = (EPIfound || CPIfound);
790 Standard_Boolean Ifound = (PVIndex != 0);
791 Standard_Boolean condmake = (!Efound && !Ifound);
793 if ( SIisvertex ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
794 else if ( OOisvertex ) PVIndex = MakeGeometry(VP,OOShapeIndex,PVKind);
795 else PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
801 if (OOedgeIndex == 0) OOedgeIndex = myDS->AddShape(OOedge,OOShapeIndex);
802 const TopOpeBRepDS_Transition& llt1 = FaceFaceTransition(1);
803 const TopOpeBRepDS_Transition& llt2 = FaceFaceTransition(2);
804 TopOpeBRepDS_Transition Trans = (ShapeIndex == 1)? llt1 : llt2;
805 Standard_Boolean TransUNK = Trans.IsUnknown();
806 TopAbs_Orientation Transori; if (!TransUNK) Transori = Trans.Orientation(TopAbs_IN);
808 TopOpeBRepDS_Transition transEdge; Standard_Boolean Tunk = Standard_True;
809 if (!TransUNK) { //xpu281098 PRO12875(edge9,OOface11)
810 if ((absindex==ShapeIndex)||(absindex==3)) {
812 // transition on Erest at VP / OOface = transition at VP on Line restriction
813 TopAbs_Orientation oriErest = Erest.Orientation();
814 transEdge = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,ShapeIndex,oriErest);
816 if (((onbound == 1)||(onbound == 2))&&tgeds) // xpu290399 : edge is restriction,
817 // edge15,OOedge14,OOface13
818 {transEdge.Before(TopAbs_UNKNOWN); transEdge.After(TopAbs_UNKNOWN);}
821 // transition on edge at VP / OOface ?=
822 // TopOpeBRep_FFTransitionTool::ProcessEdgeTransition(VP,ShapeIndex,Transori);
826 Tunk = FDS_hasUNK(transEdge);
830 // As edge=Erest is on OOFace, we only compute 2d interferences
831 Standard_Boolean ONfirstP = ::FUN_brep_ONfirstP(vpf,VP);
832 TopAbs_Orientation OVP = ONfirstP ? TopAbs_FORWARD : TopAbs_REVERSED;
833 TopAbs_Orientation oOO; Standard_Boolean ok = FUN_tool_orientEinFFORWARD(OOedge,OOFace,oOO);
835 if (M_INTERNAL(oOO)) OVP = TopAbs_INTERNAL;
837 // xpu240399 : cto015I2 (e15,v16)
838 // edge and OOedge are tangent, we do not keep the orientation
839 if (!tgeds) transEdge.Set(OVP);
842 TopOpeBRepDS_Transition Tr;
843 Standard_Boolean ok = FUN_newtransEdge(myHDS,(*this),(*myLine),myLineIsonEdge,VP,PVKind,PVIndex,OOShapeIndex,
846 transEdge.Before(Tr.Before()); transEdge.After(Tr.After());
849 if (tDSF) {cout<<"*-> new transEdge (edge"<<SIedgeIndex<<",face"<<iOOFace<<")=";
850 TopAbs::Print(transEdge.Before(),cout);
851 cout<<" ";TopAbs::Print(transEdge.After(),cout);cout<<endl;}
854 Tunk = FDS_hasUNK(transEdge);
857 TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);
858 const TopOpeBRepDS_ListOfInterference& lIedge = myHDS->DS().ShapeInterferences(edge);
859 TopOpeBRepDS_ListOfInterference copy; FDS_copy(lIedge,copy);
860 TopOpeBRepDS_ListOfInterference l1,l2; Standard_Integer nfound = FUN_selectGIinterference(copy,PVIndex,l1);
861 if (OOedgeIndex != 0) nfound = FUN_selectSIinterference(l1,OOedgeIndex,l2);
864 TopOpeBRepDS_ListOfInterference l3,l4; nfound = FUN_selectITRASHAinterference(l2,OOedgeIndex,l3);
865 if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
866 if (nfound) continue; // has I1d=(transEdge(OOedgeIndex),PVIndex,OOedgeIndex);
868 else if (iOOFace != 0) {
869 TopOpeBRepDS_ListOfInterference l3,l4; nfound = FUN_selectITRASHAinterference(l2,iOOFace,l3);
870 if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
871 if (nfound) continue; // has I2d=(transEdge(iOOFace),PVIndex,OOedgeIndex)
877 Handle(TopOpeBRepDS_Interference) EPI;
879 if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
880 TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
881 EPI = MakeEPVInterference(T,OOedgeIndex,PVIndex,paredge,PVKind,SIisvertex);
883 myHDS->StoreInterference(EPI,edge);
888 Handle(TopOpeBRepDS_Interference) EPIf;
889 TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
890 EPIf = MakeEPVInterference(T,iOOFace,PVIndex,paredge,PVKind,
891 TopOpeBRepDS_FACE,SIisvertex);
892 myHDS->StoreInterference(EPIf,edge);
897 //####################
900 static Standard_Boolean FUN_haslastvpon0(const TopOpeBRep_LineInter& L)
902 const Standard_Boolean wline = (L.TypeLineCurve() == TopOpeBRep_WALKING);
903 if (!wline) return Standard_False;
905 Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
907 TopOpeBRep_VPointInterIterator VPI;
909 for (; VPI.More(); VPI.Next()) {
910 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
911 const Standard_Integer absindex = VP.ShapeIndex();
912 const Standard_Integer iVP = VP.Index();
913 if (iVP == iINONn && absindex == 0) return Standard_True;
915 return Standard_False;
918 //=======================================================================
919 //function : FillLineVPonR
921 //=======================================================================
922 void TopOpeBRep_FacesFiller::FillLineVPonR()
925 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
926 Standard_Boolean trline = Standard_False;
928 // if a VP is on degenerated edge, adds the triplet
929 // (vertex, closing edge, degenerated edge) to the
930 // map as vertex for key.
931 // myDataforDegenEd.Clear();
932 FUN_GetdgData(myDS,(*myLine),myF1,myF2,myDataforDegenEd);
933 FUN_FillVof12((*myLine),myDS) ;
937 if (myLine->TypeLineCurve() == TopOpeBRep_RESTRICTION) {
939 if (trline) FUN_traceRLine(*myLine);
945 Standard_Integer iINON1,iINONn,nINON;
946 myLine->VPBounds(iINON1,iINONn,nINON);
952 if (trline) FUN_traceGLine(*myLine);
954 myLineIsonEdge = LSameDomainERL(*myLine, myERL);
956 // walking (case mouch1a 1 1) : line (vpfirst on 3,vplast on 0,nvpkept = 2) => kept
957 myLastVPison0 = ::FUN_haslastvpon0(*myLine);
961 if (myLineIsonEdge) cout<<" geometric line is on edge"<<endl;
962 else cout <<" geometric line not on edge"<<endl;
965 //---------------------------------------------------------------------- // IMPORTANT :
966 // Some of Curve/Point transitions for vpoints keep on RESTRICTION lines
967 // sharing same domain with the current geometric line are computed here
968 //----------------------------------------------------------------------
972 Standard_Boolean trcd = Standard_False;
973 if (trcd) FUN_DrawMap(myDataforDegenEd);
977 TopOpeBRep_VPointInterIterator VPI;
979 for (; VPI.More(); VPI.Next()) {
980 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
981 ProcessVPR((*this),VP);
984 if ( myLineIsonEdge && (!myDSCIL.IsEmpty()) ) {
989 //=======================================================================
990 //function : FillLine
992 //=======================================================================
993 void TopOpeBRep_FacesFiller::FillLine()
996 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
999 Standard_Integer iINON1,iINONn,nINON;
1000 myLine->VPBounds(iINON1,iINONn,nINON);
1001 if ( nINON == 0 ) return;
1003 Standard_Integer ShapeIndex = 0;
1004 Handle(TopOpeBRepDS_Interference) CPI;
1006 TopOpeBRep_VPointInterIterator VPI;
1007 for (VPI.Init((*myLine)); VPI.More(); VPI.Next()) {
1009 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
1010 if ( ! VP.Keep() ) continue;
1013 if (tDSF) cout<<endl;
1016 Standard_Integer PVIndex;
1017 TopOpeBRepDS_Kind PVKind;
1018 TopOpeBRepDS_ListIteratorOfListOfInterference itCPIL(myDSCIL);
1019 Standard_Boolean CPIfound;
1020 CPIfound = GetGeometry(itCPIL,VP,PVIndex,PVKind);
1022 Standard_Boolean found = GetFFGeometry(VP,PVKind,PVIndex);
1023 if ( !found ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
1026 TopOpeBRepDS_Transition transLine;
1028 Standard_Integer iVP = VPI.CurrentVPIndex();
1029 if (iVP == iINON1) transLine.Set(TopAbs_FORWARD);
1030 else if (iVP == iINONn) transLine.Set(TopAbs_REVERSED);
1032 else transLine = itCPIL.Value()->Transition().Complement();
1034 Standard_Real parline = VPI.CurrentVP().ParameterOnLine();
1035 CPI = TopOpeBRepDS_InterferenceTool::MakeCurveInterference
1036 (transLine,TopOpeBRepDS_CURVE,0,PVKind,PVIndex,parline);
1037 StoreCurveInterference(CPI);
1039 } // loop on VPoints
1043 //=======================================================================
1044 //function : AddShapesLine
1046 //=======================================================================
1047 void TopOpeBRep_FacesFiller::AddShapesLine()
1049 Standard_Boolean dscilemp = myDSCIL.IsEmpty();
1050 if (dscilemp) return;
1052 Standard_Boolean inl = myLine->INL();
1055 TopOpeBRepDS_Curve& DSC = myDS->ChangeCurve(myDSCIndex);
1057 Handle(Geom_Curve) C3D;
1058 Handle(Geom2d_Curve) PC1,PC2;
1059 Handle(TopOpeBRepDS_Interference) FCI1, FCI2;
1061 Standard_Integer iF1 = myDS->AddShape(myF1,1);
1062 Standard_Integer iF2 = myDS->AddShape(myF2,2);
1064 Standard_Real pmin,pmax;
1065 myHDS->MinMaxOnParameter(myDSCIL,pmin,pmax);
1067 Standard_Real d = Abs(pmin-pmax);
1068 Standard_Boolean id = (d <= Precision::PConfusion());
1069 Standard_Boolean isper = myLine->IsPeriodic();
1070 id = (id && !isper);
1072 Standard_Boolean wline = (myLine->TypeLineCurve() == TopOpeBRep_WALKING);
1073 Standard_Boolean vclosed = myLine->IsVClosed();
1074 if (wline && !isper && vclosed) {
1075 //xpu240399 : USA60298 : avoid creating curve
1076 // MSV: take into account that geometry can be of type VERTEX
1077 Standard_Integer ipf = myDSCIL.First()->Geometry();
1078 TopOpeBRepDS_Kind kpf = myDSCIL.First()->GeometryType();
1080 Standard_Real tol,tolf, toll;
1081 if (kpf == TopOpeBRepDS_POINT) {
1082 TopOpeBRepDS_Point pf = myDS->Point(ipf);
1084 tolf = pf.Tolerance();
1087 TopoDS_Vertex vf = TopoDS::Vertex(myDS->Shape(ipf));
1088 ptf = BRep_Tool::Pnt(vf);
1089 tolf = BRep_Tool::Tolerance(vf);
1092 Standard_Integer ipl = myDSCIL.Last()->Geometry();
1093 TopOpeBRepDS_Kind kpl = myDSCIL.Last()->GeometryType();
1094 if (kpl == TopOpeBRepDS_POINT) {
1095 TopOpeBRepDS_Point pl = myDS->Point(ipl);
1096 toll = pl.Tolerance();
1099 TopoDS_Vertex vl = TopoDS::Vertex(myDS->Shape(ipl));
1100 toll = BRep_Tool::Tolerance(vl);
1103 tol = Max(tolf, toll);
1104 Standard_Boolean onsampt = Standard_True;
1105 for (Standard_Integer ii = 1; ii <= myLine->NbWPoint(); ii++) {
1106 TopOpeBRep_WPointInter wp = myLine->WPoint(ii);
1107 gp_Pnt pp = wp.Value();
1108 if (!pp.IsEqual(ptf,tol)) {onsampt = Standard_False;break;}
1110 if (onsampt) id = Standard_True;
1114 if (TopOpeBRepDS_GettraceDSF()) {
1115 cout<<endl<<"minmax "<<pmin<<","<<pmax;
1116 if (id) cout<<" --> rejet";
1122 DSC.ChangeKeep(Standard_False);
1126 TopOpeBRep_GeomTool::MakeCurves(pmin,pmax,(*myLine),myF1,myF2,DSC,PC1,PC2);
1128 //Patch: avoid making too small edges. Made for the bug buc60926 by jgv, 14.06.01.
1129 Standard_Real fpar, lpar;
1130 DSC.Range(fpar, lpar);
1131 GeomAdaptor_Curve theCurve( DSC.Curve(), fpar, lpar );
1133 BndLib_Add3dCurve::Add( theCurve, 0., theBox );
1134 Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax, MaxSide;
1135 theBox.Get( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
1136 MaxSide = Max( Max(Xmax-Xmin, Ymax-Ymin), Zmax-Zmin );
1137 Standard_Real MinTol = Min( BRep_Tool::Tolerance(myF1), BRep_Tool::Tolerance(myF2) );
1138 if (MaxSide < MinTol)
1140 DSC.ChangeKeep(Standard_False);
1144 Standard_Real tolDSC = 1.e-8;
1145 DSC.Tolerance(tolDSC);
1146 const TopOpeBRepDS_Transition& lllt1 = FaceFaceTransition(1);
1147 const TopOpeBRepDS_Transition& lllt2 = FaceFaceTransition(2);
1149 myDS->ChangeCurveInterferences(myDSCIndex).Append(myDSCIL);
1151 TopOpeBRepDS_Transition T1 = lllt1; T1.Index(iF2);
1152 FCI1 = TopOpeBRepDS_InterferenceTool::MakeFaceCurveInterference
1153 (T1,iF2,myDSCIndex,PC1);
1154 myHDS->StoreInterference(FCI1,myF1);
1158 TopOpeBRepDS_Transition T2 = lllt2; T2.Index(iF1);
1159 FCI2 = TopOpeBRepDS_InterferenceTool::MakeFaceCurveInterference
1160 (T2,iF1,myDSCIndex,PC2);
1161 myHDS->StoreInterference(FCI2,myF2);
1164 DSC.SetShapes(myF1,myF2);
1165 DSC.SetSCI(FCI1,FCI2);
1169 //=======================================================================
1170 //function : StoreCurveInterference
1172 //=======================================================================
1173 void TopOpeBRep_FacesFiller::StoreCurveInterference(const Handle(TopOpeBRepDS_Interference)& I)
1175 if ( myDSCIndex == 0 ) {
1176 TopOpeBRepDS_Curve DSC;
1177 myDSCIndex = myDS->AddCurve(DSC);
1180 if (TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSNC())
1181 cout<<"new DSC "<<myDSCIndex<<endl;
1182 if (TopOpeBRepDS_GettraceDSLT()) myLine->DumpLineTransitions(cout);
1186 I->Support(myDSCIndex);
1187 myHDS->StoreInterference(I,myDSCIL);
1190 //=======================================================================
1191 //function : GetGeometry
1193 //=======================================================================
1194 Standard_Boolean TopOpeBRep_FacesFiller::GetGeometry(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,const TopOpeBRep_VPointInter& VP,Standard_Integer& G,TopOpeBRepDS_Kind& K)
1196 TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(VP);
1197 Standard_Boolean b = myHDS->GetGeometry(IT,DSP,G,K);
1199 Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
1201 Standard_Boolean newinDS = Standard_False; myHFFD->DumpDSP(VP,K,G,newinDS);
1207 //=======================================================================
1208 //function : MakeGeometry
1210 //=======================================================================
1211 Standard_Integer TopOpeBRep_FacesFiller::MakeGeometry(const TopOpeBRep_VPointInter& VP,const Standard_Integer ShapeIndex,TopOpeBRepDS_Kind& K)
1214 Standard_Boolean isvertex = VP.IsVertex(ShapeIndex);
1216 const TopoDS_Shape& S = VP.Vertex(ShapeIndex);
1217 G = myDS->AddShape(S,ShapeIndex);
1218 K = TopOpeBRepDS_VERTEX;
1221 TopOpeBRepDS_Point P = TopOpeBRep_PointGeomTool::MakePoint(VP);
1222 G = myDS->AddPoint(P);
1223 K = TopOpeBRepDS_POINT;
1227 Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
1229 Standard_Boolean newinDS = Standard_True; myHFFD->DumpDSP(VP,K,G,newinDS);
1236 //=======================================================================
1237 //function : GetFFGeometry
1239 //=======================================================================
1240 Standard_Boolean TopOpeBRep_FacesFiller::GetFFGeometry(const TopOpeBRepDS_Point& DSP,TopOpeBRepDS_Kind& K,Standard_Integer& G) const
1242 Standard_Boolean found = Standard_False;
1243 Standard_Integer i = myFFfirstDSP, n = myDS->NbPoints();
1244 for (; i <= n; i++) {
1245 const TopOpeBRepDS_Point& OODSP = myDS->Point(i);
1246 found = TopOpeBRep_PointGeomTool::IsEqual(DSP,OODSP);
1250 K = TopOpeBRepDS_POINT;
1256 //=======================================================================
1257 //function : GetFFGeometry
1259 //=======================================================================
1260 Standard_Boolean TopOpeBRep_FacesFiller::GetFFGeometry(const TopOpeBRep_VPointInter& VP,TopOpeBRepDS_Kind& K,Standard_Integer& G) const
1262 TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(VP);
1263 Standard_Integer found = GetFFGeometry(DSP,K,G);