1 // Created on: 1994-02-17
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <TopOpeBRep_FacesFiller.ixx>
24 #include <BRep_Tool.hxx>
27 #include <Standard_CString.hxx>
28 #include <BRepTools.hxx>
29 #include <Precision.hxx>
30 #include <TColStd_ListOfInteger.hxx>
31 #include <TColStd_ListIteratorOfListOfInteger.hxx>
33 #include <TopOpeBRep_FFDumper.hxx>
34 #include <TopOpeBRepTool_TOOL.hxx>
35 #include <TopOpeBRepTool_defineG.hxx>
36 #include <TopOpeBRepTool_EXPORT.hxx>
37 #include <TopOpeBRepTool_makeTransition.hxx>
39 #include <TopOpeBRepDS_Dumper.hxx>
40 #include <TopOpeBRepDS_InterferenceTool.hxx>
41 #include <TopOpeBRepDS_Curve.hxx>
42 #include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
44 #include <TopOpeBRep.hxx>
45 #include <TopOpeBRep_FFTransitionTool.hxx>
46 #include <TopOpeBRep_GeomTool.hxx>
47 #include <TopOpeBRep_PointGeomTool.hxx>
48 #include <TopOpeBRep_FFDumper.hxx>
50 #include <TopOpeBRep_define.hxx>
52 #include <Bnd_Box.hxx>
53 #include <BndLib_Add3dCurve.hxx>
56 #include <TopOpeBRep_DRAW.hxx>
60 Standard_EXPORT void debrest(const Standard_Integer i) {cout<<"+ debrest "<<i<<endl;}
61 Standard_EXPORT void debrline() {cout<<"+ debrline"<<endl;}
63 extern Standard_Boolean TopOpeBRepDS_GettraceCX(const Standard_Integer i);
64 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer i);
65 extern Standard_Boolean TopOpeBRepDS_GettraceSTRANGE();
66 extern Standard_Boolean TopOpeBRepDS_GettraceISTO();
67 extern Standard_Boolean TopOpeBRepDS_GettraceDSP();
68 extern Standard_Boolean TopOpeBRepDS_GettraceDSF();
69 extern Standard_Boolean TopOpeBRepDS_GettraceDSFK();
70 extern Standard_Boolean TopOpeBRepDS_GettraceDSNC();
71 extern Standard_Boolean TopOpeBRepDS_GettraceDSLT();
72 extern Standard_Boolean TopOpeBRep_GettraceNVP(Standard_Integer a,Standard_Integer b,Standard_Integer c,Standard_Integer d,Standard_Integer e);
73 extern Standard_Boolean GLOBAL_bvpr;
74 extern void debvprmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il,Standard_Integer vp,Standard_Integer si);
75 extern Standard_Boolean TopOpeBRep_GetcontextNOPUNK();
77 static void SSAVFF(const TopoDS_Shape& F1, const TopoDS_Shape& F2)
79 TCollection_AsciiString aname_1("ffbug_1"), aname_2("ffbug_2");
80 Standard_CString name_1=aname_1.ToCString(),name_2=aname_2.ToCString();
81 cout<<"FacesFiller : "<<name_1<<","<<name_2<<endl;
82 BRepTools::Write(F1,name_1); BRepTools::Write(F2,name_2);
85 static void FUN_traceRLine(const TopOpeBRep_LineInter& L)
88 TCollection_AsciiString ee("Edofline"); ee.Cat(L.Index()); char* eee = ee.ToCString();
89 DBRep::Set(eee,L.Arc());
93 static void FUN_traceGLine(const TopOpeBRep_LineInter& L)
96 TCollection_AsciiString ll("Glineof"); ll.Cat(L.Index()); char* lll = ll.ToCString();
97 Handle(Geom_Curve) c = L.Curve();
98 Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
99 Standard_Real par1 = L.VPoint(iINON1).ParameterOnLine();
100 Standard_Real parn = L.VPoint(iINONn).ParameterOnLine();
101 Standard_Boolean isperiodic = L.IsPeriodic();
102 Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(c,par1,parn,Standard_True);
103 DrawTrSurf::Set(lll,tc);
108 #define M_FORWARD(o) (o == TopAbs_FORWARD)
109 #define M_REVERSED(o) (o == TopAbs_REVERSED)
117 Standard_EXPORT void FUN_GetdgData(TopOpeBRepDS_PDataStructure& pDS,const TopOpeBRep_LineInter& L,
118 const TopoDS_Face& F1,const TopoDS_Face& F2, TopTools_DataMapOfShapeListOfShape& datamap);
119 Standard_EXPORT void FUN_FillVof12(const TopOpeBRep_LineInter& L,TopOpeBRepDS_PDataStructure pDS);
121 #define M_FINDVP (0) // only look for new vp
122 #define M_MKNEWVP (1) // only make newvp
123 #define M_GETVP (2) // steps (0) [+(1) if (O) fails]
124 Standard_EXPORT void FUN_VPIndex(TopOpeBRep_FacesFiller& FF,
125 const TopOpeBRep_LineInter& L,
126 const TopOpeBRep_VPointInter& VP,
127 const Standard_Integer ShapeIndex,
128 const Handle(TopOpeBRepDS_HDataStructure)& HDS,
129 const TopOpeBRepDS_ListOfInterference& DSCIL,
130 TopOpeBRepDS_Kind& PVKind, Standard_Integer& PVIndex, // out
131 Standard_Boolean& EPIfound, Handle(TopOpeBRepDS_Interference)& IEPI, // out
132 Standard_Boolean& CPIfound, Handle(TopOpeBRepDS_Interference)& ICPI, // out
133 const Standard_Integer mkVP);
134 Standard_EXPORT Standard_Boolean FUN_newtransEdge(const Handle(TopOpeBRepDS_HDataStructure) HDS,
135 const TopOpeBRep_FacesFiller& FF,
136 const TopOpeBRep_LineInter& L,
137 const Standard_Boolean& Lonrest,
138 const TopOpeBRep_VPointInter& VP,
139 const TopOpeBRepDS_Kind PVKind, const Standard_Integer PVIndex,
140 const Standard_Integer& OOShapeIndex,
141 const TopoDS_Edge& edge, const TopTools_ListOfShape& ERL, TopOpeBRepDS_Transition& T);
142 #define M_INTERNAL(st) (st == TopAbs_INTERNAL)
145 static Standard_Boolean FUN_IwithsuppiS(const TopOpeBRepDS_ListOfInterference& loI, const Standard_Integer iS, TopOpeBRepDS_ListOfInterference& loIfound)
147 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
148 for (; it.More(); it.Next()) {const Handle(TopOpeBRepDS_Interference)& I = it.Value();
149 if (I->Support() == iS) loIfound.Append(I);}
150 Standard_Boolean ok = (loIfound.Extent() > 0);
153 static Standard_Boolean FUN_IwithsuppkS(const TopOpeBRepDS_ListOfInterference& loI, const TopOpeBRepDS_Kind& kS, TopOpeBRepDS_ListOfInterference& loIfound)
155 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
156 for (; it.More(); it.Next()) {const Handle(TopOpeBRepDS_Interference)& I = it.Value();
157 if (I->SupportType() == kS) loIfound.Append(I);}
158 Standard_Boolean ok = (loIfound.Extent() > 0);
161 static Standard_Boolean FUN_IwithToniS(const TopOpeBRepDS_ListOfInterference& loI, const Standard_Integer iS, TopOpeBRepDS_ListOfInterference& loIfound)
163 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
164 for (; it.More(); it.Next()) {const Handle(TopOpeBRepDS_Interference)& I = it.Value();
165 if (I->Transition().Index() == iS) loIfound.Append(I);}
166 Standard_Boolean ok = (loIfound.Extent() > 0);
169 static Standard_Boolean FUN_supponF(const TopOpeBRepDS_PDataStructure pDS,
170 const TopOpeBRepDS_ListOfInterference& loI, const Standard_Integer iF,
171 TopOpeBRepDS_ListOfInterference& lIsupponF, TColStd_ListOfInteger& losupp)
173 //<losupp> = list of support S / I in <loI> : I = (T,G,S = Edge on <F>);
174 Standard_Boolean ok = (0 < iF) && (iF <= pDS->NbShapes());
175 if (!ok) return Standard_False;
177 TopTools_IndexedMapOfShape MOOE; TopExp::MapShapes(pDS->Shape(iF),TopAbs_EDGE,MOOE);
178 TopOpeBRepDS_ListIteratorOfListOfInterference it(loI);
179 for (; it.More(); it.Next()){
180 const Handle(TopOpeBRepDS_Interference)& I = it.Value(); Standard_Integer iS = I->Support();
181 TopOpeBRepDS_Kind skind = I->SupportType();
182 Standard_Boolean add = Standard_False;
183 if (skind == TopOpeBRepDS_EDGE) add = MOOE.Contains(pDS->Shape(iS));
184 if (add) {losupp.Append(iS); lIsupponF.Append(I);}
186 if (losupp.Extent() < 1) return Standard_False;
187 return Standard_True;
189 static Standard_Boolean FUN_IoflSsuppS(const TopOpeBRepDS_PDataStructure pDS,
190 const Standard_Integer iS,const TColStd_ListOfInteger& lShape,
191 TopOpeBRepDS_ListOfInterference& IsuppiS)
193 Standard_Boolean ok = Standard_False;
195 // I on E : I = (T, G, S=iS)
197 // looking for interferences attached to shapes of <lShape> with support <iS>
198 TColStd_ListIteratorOfListOfInteger iti(lShape);
199 for (; iti.More(); iti.Next()){
200 const TopOpeBRepDS_ListOfInterference& lI = pDS->ShapeInterferences(iti.Value());
201 ok = FUN_IwithsuppiS(lI,iS,IsuppiS);
206 //=======================================================================
208 // purpose : The compute of a transition edge/face given interferences
209 // attached to the edge (stored in the DS).
210 //=======================================================================
211 static Standard_Boolean FUN_findTF(const TopOpeBRepDS_PDataStructure pDS,
212 const Standard_Integer iE, const Standard_Integer iF, const Standard_Integer iOOF,
213 TopOpeBRepDS_Transition& TF)
215 Standard_Real factor = 0.5;
216 // ----------------------------------------------------------------------
217 // <Ifound> on <E> : Ifound = (T, S=OOF, G=POINT/VERTEX on <E>)
218 // (T, S=edge of OOF, G=POINT/VERTEX on <E>)
219 // ----------------------------------------------------------------------
222 TopOpeBRepDS_ListOfInterference lITonOOF;
223 Standard_Boolean ok = FUN_IwithToniS(pDS->ShapeInterferences(iE),iOOF,lITonOOF);
224 if (!ok) return Standard_False;
225 TopOpeBRepDS_ListOfInterference lITOOFskFACE;
226 Standard_Boolean found = FUN_IwithsuppkS(lITonOOF,TopOpeBRepDS_FACE,lITOOFskFACE);
228 // NYI : a deeper analysis is needed, for the moment, we make the following
229 // prequesitory : transition on E of F on point of ES is valid for
230 // all the ES (here restriction) ie :
231 // TF : transition face(F) / face(OOF) on G = ES =
232 // TE : transition edge(E) / face(OOF) at G = POINT/VERTEX
233 //Ifound on <E> : Ifound = (T(on face OOF), S=FACE, G=POINT/VERTEX on <E>)
234 const Handle(TopOpeBRepDS_Interference)& Ifound = lITOOFskFACE.First();
235 TF = Ifound->Transition();
238 Standard_Boolean done = Standard_False;
239 TopOpeBRepDS_ListOfInterference lITOOFskEDGE;
240 if (!found) done = FUN_IwithsuppkS(lITonOOF,TopOpeBRepDS_EDGE,lITOOFskEDGE);
242 // Ifound on <E> : Ifound = (T(on face OOF), S=FACE, G=POINT/VERTEX on <E>)
243 // if <Ifound> found : compute TE at G / <OOF>.
245 const Handle(TopOpeBRepDS_Interference)& Ifound = lITOOFskEDGE.First();
246 const TopoDS_Edge& OOE = TopoDS::Edge(pDS->Shape(Ifound->Support()));
247 Standard_Real paronE; Standard_Boolean OOdone = FDS_Parameter(Ifound,paronE);
248 if (!OOdone) return Standard_False;
250 const TopoDS_Edge& E = TopoDS::Edge(pDS->Shape(iE));
251 const TopoDS_Face& OOF = TopoDS::Face(pDS->Shape(iOOF));
253 Standard_Real f,l; FUN_tool_bounds(E,f,l);
254 TopOpeBRepTool_makeTransition MKT;
256 Standard_Boolean OOEboundOOF = FUN_tool_EboundF(OOE,OOF);
257 Standard_Boolean iscl = TopOpeBRepTool_TOOL::IsClosingE(OOE,OOF);
258 if (OOEboundOOF && (!iscl)) {
259 Standard_Real oopar; Standard_Boolean ok1 = FUN_tool_parE(E,paronE,OOE,oopar);
260 if (!ok1) return Standard_False;
261 gp_Pnt2d uv; ok1 = FUN_tool_paronEF(OOE,oopar,OOF,uv);
262 if (!ok1) return Standard_False;
264 ok = MKT.Initialize(E,f,l,paronE, OOF,uv, factor);
265 if (ok) ok = MKT.SetRest(OOE,oopar);
268 gp_Pnt2d uv; Standard_Boolean ok1 = FUN_tool_parF(E,paronE,OOF,uv);
269 if (!ok1) return Standard_False;
271 ok = MKT.Initialize(E,f,l,paronE, OOF,uv, factor);
273 TopAbs_State stb,sta; ok = MKT.MkTonE(stb,sta);
274 if (!ok) return Standard_False;
275 TF.Before(stb); TF.After(sta);
276 return Standard_True;
282 static Standard_Boolean FUN_findTOOF(const TopOpeBRepDS_PDataStructure pDS,
283 const Standard_Integer iE, const Standard_Integer iF, const Standard_Integer iOOF,
284 TopOpeBRepDS_Transition& TOOF)
286 Standard_Real factor = 0.5;
288 // ----------------------------------------------------------------------
291 // <OOIfound> on <OOE> : OOIfound = (T, S=iF, G=POINT/VERTEX on <E>)
292 // ----------------------------------------------------------------------
294 // <lIsuppOOE> = list of interferences attached to <E> of support S = edge of <OOF>
295 // <liOOE> = list of supports of <lIsuppOOE>.
296 const TopOpeBRepDS_ListOfInterference& loIE = pDS->ShapeInterferences(iE);
297 TopOpeBRepDS_ListOfInterference lITonOOF; Standard_Boolean ok = FUN_IwithToniS(loIE,iOOF,lITonOOF);
298 TopOpeBRepDS_ListOfInterference lIsuppOOE;
299 TColStd_ListOfInteger liOOEGonE;
301 ok = FUN_IwithsuppkS(lITonOOF,TopOpeBRepDS_EDGE,lIsuppOOE);
302 if (ok) {TopOpeBRepDS_ListIteratorOfListOfInterference it(lIsuppOOE);
303 for (; it.More(); it.Next()) liOOEGonE.Append(it.Value()->Support());}
305 else ok = FUN_supponF(pDS,loIE,iOOF,lIsuppOOE,liOOEGonE);
306 if (!ok) return Standard_False;
308 // TopAbs_Orientation oritransOOE;
310 // <lOOIfound> = list of I attached to shapes of <liOOE> /
311 // I = (T, S=F, G=POINT/VERTEX on <E>)
312 TopOpeBRepDS_ListOfInterference lIOOEsuppFGonE;
313 Standard_Boolean OOfound = FUN_IoflSsuppS(pDS,iF,liOOEGonE,lIOOEsuppFGonE);
315 // NYI : a deeper analysis is needed, for the moment, we make the following
316 // prequesitory : transition on OOE of OOF on point of ES is valid for
317 // all the ES (here restriction) ie :
318 // TOOF : transition face(OOF) / face(F) on (G == ES)
319 // <=> TOOE : transition edge(OOE) / face(F) at G = POINT/VERTEX
320 const Handle(TopOpeBRepDS_Interference)& OOIfound = lIOOEsuppFGonE.First();
321 TOOF = OOIfound->Transition();
324 Standard_Boolean OOdone = Standard_False;
326 // Ifound on <E> : Ifound = (T, S=EDGE on <OOF>, G=POINT/VERTEX on <E>)
327 // if <Ifound> found : compute TOOE at G / <F>
329 const Handle(TopOpeBRepDS_Interference)& Ifound = lIsuppOOE.First();
330 const TopoDS_Edge& OOE = TopoDS::Edge(pDS->Shape(Ifound->Support()));
331 Standard_Real paronE; OOdone = FDS_Parameter(Ifound,paronE);
332 if (!OOdone) return Standard_False;
334 const TopoDS_Edge& E = TopoDS::Edge(pDS->Shape(iE));
335 const TopoDS_Face& F = TopoDS::Face(pDS->Shape(iF));
337 Standard_Real oopar; Standard_Boolean ok1 = FUN_tool_parE(E,paronE,OOE,oopar);
338 if (!ok1) return Standard_False;
339 gp_Pnt2d uv; ok1 = FUN_tool_paronEF(E,paronE,F,uv);
340 if (!ok1) return Standard_False;
341 Standard_Real f,l; FUN_tool_bounds(OOE,f,l);
343 TopAbs_State stb,sta;
344 TopOpeBRepTool_makeTransition MKT;
345 OOdone = MKT.Initialize(OOE,f,l,oopar,F,uv,factor);
346 if (OOdone) OOdone = MKT.SetRest(E,paronE);
347 if (OOdone) OOdone = MKT.MkTonE(stb,sta);
348 if (OOdone) {TOOF.Before(stb); TOOF.After(sta);}
350 ok = OOfound || OOdone;
354 Standard_EXPORT Standard_Boolean GLOBAL_btcx = Standard_False;void debtcx(){};
355 Standard_EXPORT void debtcxmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il)
356 {cout<<"f1,f2,il : "<<f1<<","<<f2<<","<<il<<endl;cout.flush();debtcx();}
358 //=======================================================================
359 //function : ProcessLine
361 //=======================================================================
362 void TopOpeBRep_FacesFiller::ProcessLine()
364 Standard_Boolean reject = ( !myLineOK || myLine==NULL );
369 Standard_Integer ili = myLine->Index(),nli = myFacesIntersector->NbLines();
370 Standard_Boolean tcx = TopOpeBRepDS_GettraceCX(ili);
371 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
372 Standard_Boolean traceDSNC = TopOpeBRepDS_GettraceDSNC();
373 if(tDSF)cout<<"trc tnvp 1 "<<myexF1<<" "<<myexF2<<" "<<ili<<endl;
374 if (tDSF||tcx) myHFFD->DumpLine(*myLine);
375 if (traceDSNC) cout<<"line "<<ili<<"/"<<nli<<endl;
378 Standard_Boolean HasVPonR = myLine->HasVPonR();
379 if (HasVPonR) FillLineVPonR();
382 Standard_Boolean inl = myLine->INL();
385 myHDS->SortOnParameter(myDSCIL);
388 TopOpeBRepDS_Dumper Dumper(myHDS);
389 if (tDSF||traceDSNC) Dumper.DumpLOI(myDSCIL,cout,"current curve : ");
395 //=======================================================================
396 //function : ResetDSC
398 //=======================================================================
399 void TopOpeBRep_FacesFiller::ResetDSC()
405 //=======================================================================
406 //function : ProcessVPInotonR
407 //purpose : Same as ProcessVPnotonR.
408 //=======================================================================
409 void TopOpeBRep_FacesFiller::ProcessVPInotonR(TopOpeBRep_VPointInterIterator& VPI)
411 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
415 //=======================================================================
416 //function : ProcessVPnotonR
418 //=======================================================================
419 void TopOpeBRep_FacesFiller::ProcessVPnotonR(const TopOpeBRep_VPointInter& VP)
422 Standard_Boolean traceDSF = TopOpeBRepDS_GettraceDSF();
423 Standard_Boolean traceDSP = TopOpeBRepDS_GettraceDSP();
424 Standard_Boolean traceISTO = TopOpeBRepDS_GettraceISTO();
425 if (traceDSF) cout<<endl;
428 Standard_Integer ShapeIndex = 0;
429 Standard_Integer iVP = VP.Index();
432 Standard_Integer ili=myLine->Index(),ivp=iVP,isi=ShapeIndex;
433 if(traceDSF || traceDSP){
434 cout<<"trc tnvp 1 "<<myexF1<<" "<<myexF2<<" "<<ili<<" "<<ivp<<" "<<isi;
435 cout<<"; # VPonR "<<iVP<<" on "<<ShapeIndex<<endl;
438 cout<<"f1,f2,l,vp,si : ";
439 cout<<myexF1<<","<<myexF2<<","<<ili<<","<<ivp<<","<<isi<<endl;
441 GLOBAL_bvpr = TopOpeBRep_GettraceNVP(myexF1,myexF2,ili,ivp,isi);
442 if (GLOBAL_bvpr) debvprmess(myexF1,myexF2,ili,ivp,isi);
445 Standard_Integer iINON1,iINONn,nINON;
446 myLine->VPBounds(iINON1,iINONn,nINON);
447 TopOpeBRepDS_ListIteratorOfListOfInterference itCPIL(myDSCIL);
449 TopOpeBRepDS_Kind PVKind; Standard_Integer PVIndex;
450 Standard_Boolean CPIfound = GetGeometry(itCPIL,VP,PVIndex,PVKind);
452 if (iVP != iINON1 && iVP != iINONn) {
454 cout<<"VP "<<iVP<<" on "<<0<<" : point d'intersection anormal : rejet"<<endl;
461 Standard_Boolean found = GetFFGeometry(VP,PVKind,PVIndex);
462 if ( ! found ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
465 TopOpeBRepDS_Transition transLine;
467 const Handle(TopOpeBRepDS_Interference)& I = itCPIL.Value();
468 const TopOpeBRepDS_Transition& TI = I->Transition();
469 transLine = TI.Complement();
472 if (iVP == iINON1) transLine.Set(TopAbs_FORWARD);
473 else if (iVP == iINONn) transLine.Set(TopAbs_REVERSED);
476 Standard_Real parline = VP.ParameterOnLine();
477 Handle(TopOpeBRepDS_Interference) CPI = TopOpeBRepDS_InterferenceTool::MakeCurveInterference
478 (transLine,TopOpeBRepDS_CURVE,0,PVKind,PVIndex,parline);
479 StoreCurveInterference(CPI);
483 //=======================================================================
484 //function : ProcessVPR
486 //=======================================================================
487 void TopOpeBRep_FacesFiller::ProcessVPR(TopOpeBRep_FacesFiller& FF,const TopOpeBRep_VPointInter& VP)
489 TopOpeBRepDS_Transition LineTonF1 = FaceFaceTransition(1);
490 TopOpeBRepDS_Transition LineTonF2 = FaceFaceTransition(2);
491 TopoDS_Face F1 = myF1;
492 TopoDS_Face F2 = myF2;
493 // --- check interiority of VPoint to the restrictions
494 Standard_Boolean tokeep = VP.Keep();
495 if ( !tokeep ) return;
497 Standard_Integer ShapeIndex = VP.ShapeIndex();
499 if (ShapeIndex == 0) {
500 FF.ProcessVPnotonR(VP);
502 else if (ShapeIndex == 1) {
503 FF.ProcessVPonR(VP,LineTonF1,F1,1);
505 else if (ShapeIndex == 2) {
506 FF.ProcessVPonR(VP,LineTonF2,F2,2);
508 else if (ShapeIndex == 3) {
510 Standard_Boolean isV1 = VP.IsVertexOnS1();
511 Standard_Boolean isV2 = VP.IsVertexOnS2();
513 Standard_Integer shin1 = 1;
514 if (isV2 && !isV1) shin1 = 2;
517 FF.ProcessVPonR(VP,LineTonF1,F1,1);
518 FF.ProcessVPonR(VP,LineTonF2,F2,2);
520 else if (shin1 == 2) {
521 FF.ProcessVPonR(VP,LineTonF2,F2,2);
522 FF.ProcessVPonR(VP,LineTonF1,F1,1);
527 static Standard_Boolean FUN_brep_ONfirstP(const TopOpeBRep_VPointInter& vpf, const TopOpeBRep_VPointInter& VP)
528 // prequesitory : gline is on edge
530 Standard_Real parfirst = vpf.ParameterOnLine();
531 Standard_Real parcur = VP.ParameterOnLine();
532 Standard_Real d = parcur - parfirst;
533 Standard_Real tol = Precision::Confusion(); //nyixpu051098 : see lbr...
534 Standard_Boolean ONfirstP = (Abs(d) < tol);
539 static void FUN_remove(TopOpeBRepDS_ListOfInterference& lI, const Handle(TopOpeBRepDS_Interference)& I)
541 TopOpeBRepDS_ListIteratorOfListOfInterference itI(lI);
543 const Handle(TopOpeBRepDS_Interference)& Icur = itI.Value();
544 if (Icur == I) lI.Remove(itI);
550 //=======================================================================
551 //function : ProcessRLine
553 //=======================================================================
554 void TopOpeBRep_FacesFiller::ProcessRLine()
557 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
560 if (myLine->TypeLineCurve() != TopOpeBRep_RESTRICTION) {return;}
562 Standard_Boolean addIFE = Standard_True;
565 const TopoDS_Edge& Erest = TopoDS::Edge(myLine->Arc());
566 Standard_Boolean FIisrest = myFacesIntersector->IsRestriction(Erest);
567 if (!FIisrest) return;
569 Standard_Boolean isedge1 = myLine->ArcIsEdge(1);
570 Standard_Boolean isedge2 = myLine->ArcIsEdge(2);
571 Standard_Integer EShapeIndex = (isedge1) ? 1 : (isedge2) ? 2 : 0;
573 Standard_Integer iErest = myDS->AddShape(Erest,EShapeIndex);
574 Standard_Integer rank = myDS->AncestorRank(iErest);
575 Standard_Integer OOrank = (rank == 1)? 2: 1;
578 if (tDSF) {cout<<"+ edge restriction "<<myDS->SectionEdge(Erest);
579 cout<<" (DS "<<iErest<<")"<<endl;}
580 Standard_Boolean trce = TopOpeBRepDS_GettraceSPSX(iErest); if(trce) debrest(iErest);
583 Standard_Integer iF1 = myDS->AddShape(myF1,1);
584 Standard_Integer iF2 = myDS->AddShape(myF2,2);
585 Handle(TopOpeBRepDS_Interference) IFE;
587 TopOpeBRepDS_Transition T1 = FaceFaceTransition(1); T1.Index(iF2);
588 TopOpeBRepDS_Transition T2 = FaceFaceTransition(2); T2.Index(iF1);
590 Standard_Boolean T1unk = T1.IsUnknown();
591 Standard_Boolean T2unk = T2.IsUnknown();
592 Standard_Boolean processUNK = Standard_False;
594 Standard_Boolean nopunk = TopOpeBRep_GetcontextNOPUNK();
595 if (nopunk) processUNK = Standard_False;
597 if (processUNK && (T1unk || T2unk)) {
599 Standard_Boolean trc = TopOpeBRepDS_GettraceSTRANGE(); trc = trc || tDSF;
600 if (trc) cout<<"T UNKNOWN FEI F"<<iF1<<" F"<<iF2<<" on Erest"<<iErest<<endl;
602 TopoDS_Shape F = (*this).Face(rank); Standard_Integer iF = myDS->Shape(F);
603 TopoDS_Shape OOF = (*this).Face(OOrank); Standard_Integer iOOF = myDS->Shape(OOF);
604 Standard_Boolean findTOOF = (T1unk && (OOrank == 1)) || (T2unk && (OOrank == 2));
605 Standard_Boolean findTF = (T1unk && (rank == 1)) || (T2unk && (rank == 2));
610 // ?<OOIfound> on <OOE> : OOIfound = (T, S=iF, G=POINT/VERTEX on <Erest>)
611 TopOpeBRepDS_Transition T; Standard_Boolean OOTok = FUN_findTOOF(myDS,iErest,iF,iOOF,T);
613 if (OOrank == 1) FDS_SetT(T1,T);
617 cout<<"F"<<iOOF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
618 TopAbs::Print(T.After(),cout);cout<<" (F"<<iF<<") (E"<<iErest<<"))\n";
624 // ?Ifound on <Erest> : Ifound = (T on FACE=iOOF, S, G=POINT/VERTEX on <Erest>)
625 // if <Ifound> found : compute TErest at G / <OOF>
626 TopOpeBRepDS_Transition T; Standard_Boolean Tok = FUN_findTF(myDS,iErest,iF,iOOF,T);
628 if (rank == 1) FDS_SetT(T1,T);
631 if (trc) {cout<<"F"<<iF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
632 TopAbs::Print(T.After(),cout);cout<<" (F"<<iOOF<<") (E"<<iErest<<"))\n";}
636 T1unk = T1.IsUnknown();
637 T2unk = T2.IsUnknown();
638 } // processUNK && (T1unk || T2unk)
640 IFE = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference
641 (T1,iF2,iErest,isedge1,TopOpeBRepDS_UNSHGEOMETRY);
642 myHDS->StoreInterference(IFE,iF1);
644 IFE = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference
645 (T2,iF1,iErest,isedge2,TopOpeBRepDS_UNSHGEOMETRY);
646 myHDS->StoreInterference(IFE,iF2);
648 //#################### Rline Processing ####################
650 TopOpeBRep_VPointInterIterator VPI;
652 Standard_Real tola = Precision::Angular()*1.e5;//NYIXPUTOL
657 cout<<endl<<"------------ Rline processing --------------------"<<endl;
661 const TopOpeBRep_VPointInter& vpf = VPI.CurrentVP();
662 for (; VPI.More(); VPI.Next()) {
663 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
665 if (tDSF) {cout<<endl;myHFFD->DumpVP(VP);}
667 Standard_Integer absindex = VP.ShapeIndex(); // 0,1,2,3
668 Standard_Real parRest;
669 Standard_Boolean okR = VP.ParonE(Erest,parRest);
670 if (!okR) parRest = VP.ParameterOnLine();
671 Standard_Boolean on2edges = (absindex == 3) || (absindex == OOrank);
674 // MSV: treat the case when an edge is touched by interior of a face
676 // MSV: the commented code below leads to exception on 1cto 025 H3
677 // (object and tool have same subshapes), so to enable it
678 // the debug is needed
680 // Standard_Boolean SIisvertex = VP.IsVertex(EShapeIndex);
681 // if (SIisvertex) continue;
682 // Standard_Integer ShapeIndex = EShapeIndex;
683 // Standard_Integer OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
684 // TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
685 // Standard_Integer iOOFace = myDS->Shape(OOFace);
688 // TopOpeBRepDS_Kind PVKind = TopOpeBRepDS_POINT;
689 // Standard_Integer PVIndex = 0;
690 // Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False;
691 // Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
692 // FUN_VPIndex((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL,
693 // PVKind,PVIndex,EPIfound,IEPI,CPIfound,ICPI,
695 // Standard_Boolean Efound = (EPIfound || CPIfound);
696 // Standard_Boolean Ifound = (PVIndex != 0);
697 // Standard_Boolean condmake = (!Efound && !Ifound);
699 // PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
701 // // make transition on edge
702 // TopOpeBRepDS_Transition transEdge;
703 // TopOpeBRepDS_Transition Trans = FaceFaceTransition(ShapeIndex);
704 // Standard_Boolean TransUNK = Trans.IsUnknown();
706 // TopAbs_Orientation oriErest = Erest.Orientation();
707 // transEdge = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,ShapeIndex,oriErest);
708 // TransUNK = FDS_hasUNK(transEdge);
711 // Standard_Boolean ONfirstP = ::FUN_brep_ONfirstP(vpf,VP);
712 // TopAbs_Orientation OVP = ONfirstP ? TopAbs_FORWARD : TopAbs_REVERSED;
713 // transEdge.Set(OVP);
714 // if (ONfirstP) transEdge.StateAfter(TopAbs_ON);
715 // else transEdge.StateBefore(TopAbs_ON);
716 // TransUNK = FDS_hasUNK(transEdge);
718 // if (TransUNK) continue;
720 // // see if there is already such interference in DS
721 // TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);
722 // const TopOpeBRepDS_ListOfInterference& lIedge = myHDS->DS().ShapeInterferences(Erest);
723 // TopOpeBRepDS_ListOfInterference copy; FDS_copy(lIedge,copy);
724 // TopOpeBRepDS_ListOfInterference l1,l2;
725 // Standard_Integer nfound = FUN_selectGIinterference(copy,PVIndex,l1);
727 // if (iOOFace != 0) {
728 // TopOpeBRepDS_ListOfInterference l3,l4;
729 // nfound = FUN_selectITRASHAinterference(l2,iOOFace,l3);
730 // if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
731 // if (nfound) continue;
735 // // make and store interference
736 // Handle(TopOpeBRepDS_Interference) EPIf;
737 // if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
738 // TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
739 // EPIf = MakeEPVInterference(T,iOOFace,PVIndex,parRest,PVKind,
740 // TopOpeBRepDS_FACE,SIisvertex);
741 // myHDS->StoreInterference(EPIf,Erest);
746 TopoDS_Edge OOE = TopoDS::Edge(VP.Edge(OOrank));
747 Standard_Integer iOO = myDS->AddShape(OOE,OOrank);
750 VP.ParonE(OOE,OOpar);
752 // xpu091198 : 1d interf done in EdgesFiller processing (cto cylcong *)
753 Standard_Boolean sdmeds = FUN_ds_sdm((*myDS),Erest,OOE);
754 if (sdmeds) continue;
756 Standard_Integer obRest = TopOpeBRepTool_TOOL::OnBoundary(parRest,Erest); //vertex can be missed
757 Standard_Integer obOO = TopOpeBRepTool_TOOL::OnBoundary(OOpar,OOE); //vertex can be missed
759 if ((obRest == EXTERNAL)||(obOO == EXTERNAL)){
761 if(obRest==EXTERNAL) cout<<"***********ProcessRLine : faulty parameter on Erest"<<endl;
762 if(obOO==EXTERNAL) cout<<"***********ProcessRLine : faulty parameter on OOE"<<endl;
766 Standard_Boolean tgeds = FUN_tool_EtgOOE(parRest,Erest, OOpar,OOE, tola);
768 TopOpeBRepDS_Kind PVKind = TopOpeBRepDS_POINT; Standard_Integer PVIndex = 0; // POINT or VERTEX index
770 for (Standard_Integer ShapeIndex = 1; ShapeIndex<=2; ShapeIndex++) {
771 Standard_Integer OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
772 Standard_Boolean SIErest = (ShapeIndex == rank);
774 Standard_Boolean SIisvertex = VP.IsVertex(ShapeIndex);
775 Standard_Boolean OOisvertex = VP.IsVertex(OOShapeIndex);
776 TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
777 Standard_Integer iOOFace = myDS->Shape(OOFace);
779 TopoDS_Edge edge,OOedge; Standard_Integer SIedgeIndex,OOedgeIndex;
780 Standard_Real paredge,OOparedge;
781 Standard_Integer onbound;
783 {edge = Erest; SIedgeIndex = iErest; paredge = parRest; onbound = obRest;
784 OOedge = OOE; OOedgeIndex = iOO; OOparedge = OOpar;}
786 {OOedge = Erest;OOedgeIndex = iErest; OOparedge = parRest; onbound = obOO;
787 edge = OOE; SIedgeIndex = iOO; paredge = OOpar;}
791 // xpu150399 : BUC60382
792 Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False; Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
793 ProcessVPondgE(VP, ShapeIndex,
794 PVKind,PVIndex, // out
795 EPIfound,IEPI, // out
796 CPIfound,ICPI); // out
799 // Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False; Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
800 FUN_VPIndex((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL,
801 PVKind,PVIndex,EPIfound,IEPI,CPIfound,ICPI,
803 Standard_Boolean Efound = (EPIfound || CPIfound);
804 Standard_Boolean Ifound = (PVIndex != 0);
805 Standard_Boolean condmake = (!Efound && !Ifound);
807 if ( SIisvertex ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
808 else if ( OOisvertex ) PVIndex = MakeGeometry(VP,OOShapeIndex,PVKind);
809 else PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
815 if (OOedgeIndex == 0) OOedgeIndex = myDS->AddShape(OOedge,OOShapeIndex);
816 const TopOpeBRepDS_Transition& llt1 = FaceFaceTransition(1);
817 const TopOpeBRepDS_Transition& llt2 = FaceFaceTransition(2);
818 TopOpeBRepDS_Transition Trans = (ShapeIndex == 1)? llt1 : llt2;
819 Standard_Boolean TransUNK = Trans.IsUnknown();
820 TopAbs_Orientation Transori; if (!TransUNK) Transori = Trans.Orientation(TopAbs_IN);
822 TopOpeBRepDS_Transition transEdge; Standard_Boolean Tunk = Standard_True;
823 if (!TransUNK) { //xpu281098 PRO12875(edge9,OOface11)
824 if ((absindex==ShapeIndex)||(absindex==3)) {
826 // transition on Erest at VP / OOface = transition at VP on Line restriction
827 TopAbs_Orientation oriErest = Erest.Orientation();
828 transEdge = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,ShapeIndex,oriErest);
830 if (((onbound == 1)||(onbound == 2))&&tgeds) // xpu290399 : edge is restriction,
831 // edge15,OOedge14,OOface13
832 {transEdge.Before(TopAbs_UNKNOWN); transEdge.After(TopAbs_UNKNOWN);}
835 // transition on edge at VP / OOface ?=
836 // TopOpeBRep_FFTransitionTool::ProcessEdgeTransition(VP,ShapeIndex,Transori);
840 Tunk = FDS_hasUNK(transEdge);
844 // As edge=Erest is on OOFace, we only compute 2d interferences
845 Standard_Boolean ONfirstP = ::FUN_brep_ONfirstP(vpf,VP);
846 TopAbs_Orientation OVP = ONfirstP ? TopAbs_FORWARD : TopAbs_REVERSED;
847 TopAbs_Orientation oOO; Standard_Boolean ok = FUN_tool_orientEinFFORWARD(OOedge,OOFace,oOO);
849 if (M_INTERNAL(oOO)) OVP = TopAbs_INTERNAL;
851 // xpu240399 : cto015I2 (e15,v16)
852 // edge and OOedge are tangent, we do not keep the orientation
853 if (!tgeds) transEdge.Set(OVP);
856 TopOpeBRepDS_Transition Tr;
857 Standard_Boolean ok = FUN_newtransEdge(myHDS,(*this),(*myLine),myLineIsonEdge,VP,PVKind,PVIndex,OOShapeIndex,
860 transEdge.Before(Tr.Before()); transEdge.After(Tr.After());
863 if (tDSF) {cout<<"*-> new transEdge (edge"<<SIedgeIndex<<",face"<<iOOFace<<")=";
864 TopAbs::Print(transEdge.Before(),cout);
865 cout<<" ";TopAbs::Print(transEdge.After(),cout);cout<<endl;}
868 Tunk = FDS_hasUNK(transEdge);
871 TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);
872 const TopOpeBRepDS_ListOfInterference& lIedge = myHDS->DS().ShapeInterferences(edge);
873 TopOpeBRepDS_ListOfInterference copy; FDS_copy(lIedge,copy);
874 TopOpeBRepDS_ListOfInterference l1,l2; Standard_Integer nfound = FUN_selectGIinterference(copy,PVIndex,l1);
875 if (OOedgeIndex != 0) nfound = FUN_selectSIinterference(l1,OOedgeIndex,l2);
878 TopOpeBRepDS_ListOfInterference l3,l4; nfound = FUN_selectITRASHAinterference(l2,OOedgeIndex,l3);
879 if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
880 if (nfound) continue; // has I1d=(transEdge(OOedgeIndex),PVIndex,OOedgeIndex);
882 else if (iOOFace != 0) {
883 TopOpeBRepDS_ListOfInterference l3,l4; nfound = FUN_selectITRASHAinterference(l2,iOOFace,l3);
884 if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
885 if (nfound) continue; // has I2d=(transEdge(iOOFace),PVIndex,OOedgeIndex)
891 Handle(TopOpeBRepDS_Interference) EPI;
893 if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
894 TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
895 EPI = MakeEPVInterference(T,OOedgeIndex,PVIndex,paredge,PVKind,SIisvertex);
897 myHDS->StoreInterference(EPI,edge);
902 Handle(TopOpeBRepDS_Interference) EPIf;
903 TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
904 EPIf = MakeEPVInterference(T,iOOFace,PVIndex,paredge,PVKind,
905 TopOpeBRepDS_FACE,SIisvertex);
906 myHDS->StoreInterference(EPIf,edge);
911 //####################
914 static Standard_Boolean FUN_haslastvpon0(const TopOpeBRep_LineInter& L)
916 const Standard_Boolean wline = (L.TypeLineCurve() == TopOpeBRep_WALKING);
917 if (!wline) return Standard_False;
919 Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
921 TopOpeBRep_VPointInterIterator VPI;
923 for (; VPI.More(); VPI.Next()) {
924 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
925 const Standard_Integer absindex = VP.ShapeIndex();
926 const Standard_Integer iVP = VP.Index();
927 if (iVP == iINONn && absindex == 0) return Standard_True;
929 return Standard_False;
932 //=======================================================================
933 //function : FillLineVPonR
935 //=======================================================================
936 void TopOpeBRep_FacesFiller::FillLineVPonR()
939 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
940 Standard_Boolean trline = Standard_False;
942 // if a VP is on degenerated edge, adds the triplet
943 // (vertex, closing edge, degenerated edge) to the
944 // map as vertex for key.
945 // myDataforDegenEd.Clear();
946 FUN_GetdgData(myDS,(*myLine),myF1,myF2,myDataforDegenEd);
947 FUN_FillVof12((*myLine),myDS) ;
951 if (myLine->TypeLineCurve() == TopOpeBRep_RESTRICTION) {
953 if (trline) FUN_traceRLine(*myLine);
959 Standard_Integer iINON1,iINONn,nINON;
960 myLine->VPBounds(iINON1,iINONn,nINON);
966 if (trline) FUN_traceGLine(*myLine);
968 myLineIsonEdge = LSameDomainERL(*myLine, myERL);
970 // walking (case mouch1a 1 1) : line (vpfirst on 3,vplast on 0,nvpkept = 2) => kept
971 myLastVPison0 = ::FUN_haslastvpon0(*myLine);
975 if (myLineIsonEdge) cout<<" geometric line is on edge"<<endl;
976 else cout <<" geometric line not on edge"<<endl;
979 //---------------------------------------------------------------------- // IMPORTANT :
980 // Some of Curve/Point transitions for vpoints keep on RESTRICTION lines
981 // sharing same domain with the current geometric line are computed here
982 //----------------------------------------------------------------------
985 Standard_Boolean trcd = Standard_False;
987 if (trcd) FUN_DrawMap(myDataforDegenEd);
991 TopOpeBRep_VPointInterIterator VPI;
993 for (; VPI.More(); VPI.Next()) {
994 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
995 ProcessVPR((*this),VP);
998 if ( myLineIsonEdge && (!myDSCIL.IsEmpty()) ) {
1003 //=======================================================================
1004 //function : FillLine
1006 //=======================================================================
1007 void TopOpeBRep_FacesFiller::FillLine()
1010 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
1013 Standard_Integer iINON1,iINONn,nINON;
1014 myLine->VPBounds(iINON1,iINONn,nINON);
1015 if ( nINON == 0 ) return;
1017 Standard_Integer ShapeIndex = 0;
1018 Handle(TopOpeBRepDS_Interference) CPI;
1020 TopOpeBRep_VPointInterIterator VPI;
1021 for (VPI.Init((*myLine)); VPI.More(); VPI.Next()) {
1023 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
1024 if ( ! VP.Keep() ) continue;
1027 if (tDSF) cout<<endl;
1030 Standard_Integer PVIndex;
1031 TopOpeBRepDS_Kind PVKind;
1032 TopOpeBRepDS_ListIteratorOfListOfInterference itCPIL(myDSCIL);
1033 Standard_Boolean CPIfound;
1034 CPIfound = GetGeometry(itCPIL,VP,PVIndex,PVKind);
1036 Standard_Boolean found = GetFFGeometry(VP,PVKind,PVIndex);
1037 if ( !found ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
1040 TopOpeBRepDS_Transition transLine;
1042 Standard_Integer iVP = VPI.CurrentVPIndex();
1043 if (iVP == iINON1) transLine.Set(TopAbs_FORWARD);
1044 else if (iVP == iINONn) transLine.Set(TopAbs_REVERSED);
1046 else transLine = itCPIL.Value()->Transition().Complement();
1048 Standard_Real parline = VPI.CurrentVP().ParameterOnLine();
1049 CPI = TopOpeBRepDS_InterferenceTool::MakeCurveInterference
1050 (transLine,TopOpeBRepDS_CURVE,0,PVKind,PVIndex,parline);
1051 StoreCurveInterference(CPI);
1053 } // loop on VPoints
1057 //=======================================================================
1058 //function : AddShapesLine
1060 //=======================================================================
1061 void TopOpeBRep_FacesFiller::AddShapesLine()
1063 Standard_Boolean dscilemp = myDSCIL.IsEmpty();
1064 if (dscilemp) return;
1066 Standard_Boolean inl = myLine->INL();
1069 TopOpeBRepDS_Curve& DSC = myDS->ChangeCurve(myDSCIndex);
1071 Handle(Geom_Curve) C3D;
1072 Handle(Geom2d_Curve) PC1,PC2;
1073 Handle(TopOpeBRepDS_Interference) FCI1, FCI2;
1075 Standard_Integer iF1 = myDS->AddShape(myF1,1);
1076 Standard_Integer iF2 = myDS->AddShape(myF2,2);
1078 Standard_Real pmin,pmax;
1079 myHDS->MinMaxOnParameter(myDSCIL,pmin,pmax);
1081 Standard_Real d = Abs(pmin-pmax);
1082 Standard_Boolean id = (d <= Precision::PConfusion());
1083 Standard_Boolean isper = myLine->IsPeriodic();
1084 id = (id && !isper);
1086 Standard_Boolean wline = (myLine->TypeLineCurve() == TopOpeBRep_WALKING);
1087 Standard_Boolean vclosed = myLine->IsVClosed();
1088 if (wline && !isper && vclosed) {
1089 //xpu240399 : USA60298 : avoid creating curve
1090 // MSV: take into account that geometry can be of type VERTEX
1091 Standard_Integer ipf = myDSCIL.First()->Geometry();
1092 TopOpeBRepDS_Kind kpf = myDSCIL.First()->GeometryType();
1094 Standard_Real tol,tolf, toll;
1095 if (kpf == TopOpeBRepDS_POINT) {
1096 TopOpeBRepDS_Point pf = myDS->Point(ipf);
1098 tolf = pf.Tolerance();
1101 TopoDS_Vertex vf = TopoDS::Vertex(myDS->Shape(ipf));
1102 ptf = BRep_Tool::Pnt(vf);
1103 tolf = BRep_Tool::Tolerance(vf);
1106 Standard_Integer ipl = myDSCIL.Last()->Geometry();
1107 TopOpeBRepDS_Kind kpl = myDSCIL.Last()->GeometryType();
1108 if (kpl == TopOpeBRepDS_POINT) {
1109 TopOpeBRepDS_Point pl = myDS->Point(ipl);
1110 toll = pl.Tolerance();
1113 TopoDS_Vertex vl = TopoDS::Vertex(myDS->Shape(ipl));
1114 toll = BRep_Tool::Tolerance(vl);
1117 tol = Max(tolf, toll);
1118 Standard_Boolean onsampt = Standard_True;
1119 for (Standard_Integer ii = 1; ii <= myLine->NbWPoint(); ii++) {
1120 TopOpeBRep_WPointInter wp = myLine->WPoint(ii);
1121 gp_Pnt pp = wp.Value();
1122 if (!pp.IsEqual(ptf,tol)) {onsampt = Standard_False;break;}
1124 if (onsampt) id = Standard_True;
1128 if (TopOpeBRepDS_GettraceDSF()) {
1129 cout<<endl<<"minmax "<<pmin<<","<<pmax;
1130 if (id) cout<<" --> rejet";
1136 DSC.ChangeKeep(Standard_False);
1140 TopOpeBRep_GeomTool::MakeCurves(pmin,pmax,(*myLine),myF1,myF2,DSC,PC1,PC2);
1142 //Patch: avoid making too small edges. Made for the bug buc60926 by jgv, 14.06.01.
1143 Standard_Real fpar, lpar;
1144 DSC.Range(fpar, lpar);
1145 GeomAdaptor_Curve theCurve( DSC.Curve(), fpar, lpar );
1147 BndLib_Add3dCurve::Add( theCurve, 0., theBox );
1148 Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax, MaxSide;
1149 theBox.Get( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
1150 MaxSide = Max( Max(Xmax-Xmin, Ymax-Ymin), Zmax-Zmin );
1151 Standard_Real MinTol = Min( BRep_Tool::Tolerance(myF1), BRep_Tool::Tolerance(myF2) );
1152 if (MaxSide < MinTol)
1154 DSC.ChangeKeep(Standard_False);
1158 Standard_Real tolDSC = 1.e-8;
1159 DSC.Tolerance(tolDSC);
1160 const TopOpeBRepDS_Transition& lllt1 = FaceFaceTransition(1);
1161 const TopOpeBRepDS_Transition& lllt2 = FaceFaceTransition(2);
1163 myDS->ChangeCurveInterferences(myDSCIndex).Append(myDSCIL);
1165 TopOpeBRepDS_Transition T1 = lllt1; T1.Index(iF2);
1166 FCI1 = TopOpeBRepDS_InterferenceTool::MakeFaceCurveInterference
1167 (T1,iF2,myDSCIndex,PC1);
1168 myHDS->StoreInterference(FCI1,myF1);
1172 TopOpeBRepDS_Transition T2 = lllt2; T2.Index(iF1);
1173 FCI2 = TopOpeBRepDS_InterferenceTool::MakeFaceCurveInterference
1174 (T2,iF1,myDSCIndex,PC2);
1175 myHDS->StoreInterference(FCI2,myF2);
1178 DSC.SetShapes(myF1,myF2);
1179 DSC.SetSCI(FCI1,FCI2);
1183 //=======================================================================
1184 //function : StoreCurveInterference
1186 //=======================================================================
1187 void TopOpeBRep_FacesFiller::StoreCurveInterference(const Handle(TopOpeBRepDS_Interference)& I)
1189 if ( myDSCIndex == 0 ) {
1190 TopOpeBRepDS_Curve DSC;
1191 myDSCIndex = myDS->AddCurve(DSC);
1194 if (TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSNC())
1195 cout<<"new DSC "<<myDSCIndex<<endl;
1196 if (TopOpeBRepDS_GettraceDSLT()) myLine->DumpLineTransitions(cout);
1200 I->Support(myDSCIndex);
1201 myHDS->StoreInterference(I,myDSCIL);
1204 //=======================================================================
1205 //function : GetGeometry
1207 //=======================================================================
1208 Standard_Boolean TopOpeBRep_FacesFiller::GetGeometry(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,const TopOpeBRep_VPointInter& VP,Standard_Integer& G,TopOpeBRepDS_Kind& K)
1210 TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(VP);
1211 Standard_Boolean b = myHDS->GetGeometry(IT,DSP,G,K);
1213 Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
1215 Standard_Boolean newinDS = Standard_False; myHFFD->DumpDSP(VP,K,G,newinDS);
1221 //=======================================================================
1222 //function : MakeGeometry
1224 //=======================================================================
1225 Standard_Integer TopOpeBRep_FacesFiller::MakeGeometry(const TopOpeBRep_VPointInter& VP,const Standard_Integer ShapeIndex,TopOpeBRepDS_Kind& K)
1228 Standard_Boolean isvertex = VP.IsVertex(ShapeIndex);
1230 const TopoDS_Shape& S = VP.Vertex(ShapeIndex);
1231 G = myDS->AddShape(S,ShapeIndex);
1232 K = TopOpeBRepDS_VERTEX;
1235 TopOpeBRepDS_Point P = TopOpeBRep_PointGeomTool::MakePoint(VP);
1236 G = myDS->AddPoint(P);
1237 K = TopOpeBRepDS_POINT;
1241 Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
1243 Standard_Boolean newinDS = Standard_True; myHFFD->DumpDSP(VP,K,G,newinDS);
1250 //=======================================================================
1251 //function : GetFFGeometry
1253 //=======================================================================
1254 Standard_Boolean TopOpeBRep_FacesFiller::GetFFGeometry(const TopOpeBRepDS_Point& DSP,TopOpeBRepDS_Kind& K,Standard_Integer& G) const
1256 Standard_Boolean found = Standard_False;
1257 Standard_Integer i = myFFfirstDSP, n = myDS->NbPoints();
1258 for (; i <= n; i++) {
1259 const TopOpeBRepDS_Point& OODSP = myDS->Point(i);
1260 found = TopOpeBRep_PointGeomTool::IsEqual(DSP,OODSP);
1264 K = TopOpeBRepDS_POINT;
1270 //=======================================================================
1271 //function : GetFFGeometry
1273 //=======================================================================
1274 Standard_Boolean TopOpeBRep_FacesFiller::GetFFGeometry(const TopOpeBRep_VPointInter& VP,TopOpeBRepDS_Kind& K,Standard_Integer& G) const
1276 TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(VP);
1277 Standard_Integer found = GetFFGeometry(DSP,K,G);