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));
252 const TopoDS_Face& F =
254 TopoDS::Face(pDS->Shape(iF));
255 const TopoDS_Face& OOF = TopoDS::Face(pDS->Shape(iOOF));
257 Standard_Real f,l; FUN_tool_bounds(E,f,l);
258 TopOpeBRepTool_makeTransition MKT;
260 Standard_Boolean OOEboundOOF = FUN_tool_EboundF(OOE,OOF);
261 Standard_Boolean iscl = TopOpeBRepTool_TOOL::IsClosingE(OOE,OOF);
262 if (OOEboundOOF && (!iscl)) {
263 Standard_Real oopar; Standard_Boolean ok1 = FUN_tool_parE(E,paronE,OOE,oopar);
264 if (!ok1) return Standard_False;
265 gp_Pnt2d uv; ok1 = FUN_tool_paronEF(OOE,oopar,OOF,uv);
266 if (!ok1) return Standard_False;
268 ok = MKT.Initialize(E,f,l,paronE, OOF,uv, factor);
269 if (ok) ok = MKT.SetRest(OOE,oopar);
272 gp_Pnt2d uv; Standard_Boolean ok1 = FUN_tool_parF(E,paronE,OOF,uv);
273 if (!ok1) return Standard_False;
275 ok = MKT.Initialize(E,f,l,paronE, OOF,uv, factor);
277 TopAbs_State stb,sta; ok = MKT.MkTonE(stb,sta);
278 if (!ok) return Standard_False;
279 TF.Before(stb); TF.After(sta);
280 return Standard_True;
286 static Standard_Boolean FUN_findTOOF(const TopOpeBRepDS_PDataStructure pDS,
287 const Standard_Integer iE, const Standard_Integer iF, const Standard_Integer iOOF,
288 TopOpeBRepDS_Transition& TOOF)
290 Standard_Real factor = 0.5;
292 // ----------------------------------------------------------------------
295 // <OOIfound> on <OOE> : OOIfound = (T, S=iF, G=POINT/VERTEX on <E>)
296 // ----------------------------------------------------------------------
298 // <lIsuppOOE> = list of interferences attached to <E> of support S = edge of <OOF>
299 // <liOOE> = list of supports of <lIsuppOOE>.
300 const TopOpeBRepDS_ListOfInterference& loIE = pDS->ShapeInterferences(iE);
301 TopOpeBRepDS_ListOfInterference lITonOOF; Standard_Boolean ok = FUN_IwithToniS(loIE,iOOF,lITonOOF);
302 TopOpeBRepDS_ListOfInterference lIsuppOOE;
303 TColStd_ListOfInteger liOOEGonE;
305 ok = FUN_IwithsuppkS(lITonOOF,TopOpeBRepDS_EDGE,lIsuppOOE);
306 if (ok) {TopOpeBRepDS_ListIteratorOfListOfInterference it(lIsuppOOE);
307 for (; it.More(); it.Next()) liOOEGonE.Append(it.Value()->Support());}
309 else ok = FUN_supponF(pDS,loIE,iOOF,lIsuppOOE,liOOEGonE);
310 if (!ok) return Standard_False;
312 // TopAbs_Orientation oritransOOE;
314 // <lOOIfound> = list of I attached to shapes of <liOOE> /
315 // I = (T, S=F, G=POINT/VERTEX on <E>)
316 TopOpeBRepDS_ListOfInterference lIOOEsuppFGonE;
317 Standard_Boolean OOfound = FUN_IoflSsuppS(pDS,iF,liOOEGonE,lIOOEsuppFGonE);
319 // NYI : a deeper analysis is needed, for the moment, we make the following
320 // prequesitory : transition on OOE of OOF on point of ES is valid for
321 // all the ES (here restriction) ie :
322 // TOOF : transition face(OOF) / face(F) on (G == ES)
323 // <=> TOOE : transition edge(OOE) / face(F) at G = POINT/VERTEX
324 const Handle(TopOpeBRepDS_Interference)& OOIfound = lIOOEsuppFGonE.First();
325 TOOF = OOIfound->Transition();
328 Standard_Boolean OOdone = Standard_False;
330 // Ifound on <E> : Ifound = (T, S=EDGE on <OOF>, G=POINT/VERTEX on <E>)
331 // if <Ifound> found : compute TOOE at G / <F>
333 const Handle(TopOpeBRepDS_Interference)& Ifound = lIsuppOOE.First();
334 const TopoDS_Edge& OOE = TopoDS::Edge(pDS->Shape(Ifound->Support()));
335 Standard_Real paronE; OOdone = FDS_Parameter(Ifound,paronE);
336 if (!OOdone) return Standard_False;
338 const TopoDS_Edge& E = TopoDS::Edge(pDS->Shape(iE));
339 const TopoDS_Face& F = TopoDS::Face(pDS->Shape(iF));
341 Standard_Real oopar; Standard_Boolean ok1 = FUN_tool_parE(E,paronE,OOE,oopar);
342 if (!ok1) return Standard_False;
343 gp_Pnt2d uv; ok1 = FUN_tool_paronEF(E,paronE,F,uv);
344 if (!ok1) return Standard_False;
345 Standard_Real f,l; FUN_tool_bounds(OOE,f,l);
347 TopAbs_State stb,sta;
348 TopOpeBRepTool_makeTransition MKT;
349 OOdone = MKT.Initialize(OOE,f,l,oopar,F,uv,factor);
350 if (OOdone) OOdone = MKT.SetRest(E,paronE);
351 if (OOdone) OOdone = MKT.MkTonE(stb,sta);
352 if (OOdone) {TOOF.Before(stb); TOOF.After(sta);}
354 ok = OOfound || OOdone;
358 Standard_EXPORT Standard_Boolean GLOBAL_btcx = Standard_False;void debtcx(){};
359 Standard_EXPORT void debtcxmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il)
360 {cout<<"f1,f2,il : "<<f1<<","<<f2<<","<<il<<endl;cout.flush();debtcx();}
362 //=======================================================================
363 //function : ProcessLine
365 //=======================================================================
366 void TopOpeBRep_FacesFiller::ProcessLine()
368 Standard_Boolean reject = ( !myLineOK || myLine==NULL );
373 Standard_Integer ili = myLine->Index(),nli = myFacesIntersector->NbLines();
374 Standard_Boolean tcx = TopOpeBRepDS_GettraceCX(ili);
375 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
376 Standard_Boolean traceDSNC = TopOpeBRepDS_GettraceDSNC();
377 if(tDSF)cout<<"trc tnvp 1 "<<myexF1<<" "<<myexF2<<" "<<ili<<endl;
378 if (tDSF||tcx) myHFFD->DumpLine(*myLine);
379 if (traceDSNC) cout<<"line "<<ili<<"/"<<nli<<endl;
382 Standard_Boolean HasVPonR = myLine->HasVPonR();
383 if (HasVPonR) FillLineVPonR();
386 Standard_Boolean inl = myLine->INL();
389 myHDS->SortOnParameter(myDSCIL);
392 TopOpeBRepDS_Dumper Dumper(myHDS);
393 if (tDSF||traceDSNC) Dumper.DumpLOI(myDSCIL,cout,"current curve : ");
399 //=======================================================================
400 //function : ResetDSC
402 //=======================================================================
403 void TopOpeBRep_FacesFiller::ResetDSC()
409 //=======================================================================
410 //function : ProcessVPInotonR
411 //purpose : Same as ProcessVPnotonR.
412 //=======================================================================
413 void TopOpeBRep_FacesFiller::ProcessVPInotonR(TopOpeBRep_VPointInterIterator& VPI)
415 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
419 //=======================================================================
420 //function : ProcessVPnotonR
422 //=======================================================================
423 void TopOpeBRep_FacesFiller::ProcessVPnotonR(const TopOpeBRep_VPointInter& VP)
426 Standard_Boolean traceDSF = TopOpeBRepDS_GettraceDSF();
427 Standard_Boolean traceDSP = TopOpeBRepDS_GettraceDSP();
428 Standard_Boolean traceISTO = TopOpeBRepDS_GettraceISTO();
429 if (traceDSF) cout<<endl;
432 Standard_Integer ShapeIndex = 0;
433 Standard_Integer iVP = VP.Index();
436 Standard_Integer ili=myLine->Index(),ivp=iVP,isi=ShapeIndex;
437 if(traceDSF || traceDSP){
438 cout<<"trc tnvp 1 "<<myexF1<<" "<<myexF2<<" "<<ili<<" "<<ivp<<" "<<isi;
439 cout<<"; # VPonR "<<iVP<<" on "<<ShapeIndex<<endl;
442 cout<<"f1,f2,l,vp,si : ";
443 cout<<myexF1<<","<<myexF2<<","<<ili<<","<<ivp<<","<<isi<<endl;
445 GLOBAL_bvpr = TopOpeBRep_GettraceNVP(myexF1,myexF2,ili,ivp,isi);
446 if (GLOBAL_bvpr) debvprmess(myexF1,myexF2,ili,ivp,isi);
449 Standard_Integer iINON1,iINONn,nINON;
450 myLine->VPBounds(iINON1,iINONn,nINON);
451 TopOpeBRepDS_ListIteratorOfListOfInterference itCPIL(myDSCIL);
453 TopOpeBRepDS_Kind PVKind; Standard_Integer PVIndex;
454 Standard_Boolean CPIfound = GetGeometry(itCPIL,VP,PVIndex,PVKind);
456 if (iVP != iINON1 && iVP != iINONn) {
458 cout<<"VP "<<iVP<<" on "<<0<<" : point d'intersection anormal : rejet"<<endl;
465 Standard_Boolean found = GetFFGeometry(VP,PVKind,PVIndex);
466 if ( ! found ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
469 TopOpeBRepDS_Transition transLine;
471 const Handle(TopOpeBRepDS_Interference)& I = itCPIL.Value();
472 const TopOpeBRepDS_Transition& TI = I->Transition();
473 transLine = TI.Complement();
476 if (iVP == iINON1) transLine.Set(TopAbs_FORWARD);
477 else if (iVP == iINONn) transLine.Set(TopAbs_REVERSED);
480 Standard_Real parline = VP.ParameterOnLine();
481 Handle(TopOpeBRepDS_Interference) CPI = TopOpeBRepDS_InterferenceTool::MakeCurveInterference
482 (transLine,TopOpeBRepDS_CURVE,0,PVKind,PVIndex,parline);
483 StoreCurveInterference(CPI);
487 //=======================================================================
488 //function : ProcessVPR
490 //=======================================================================
491 void TopOpeBRep_FacesFiller::ProcessVPR(TopOpeBRep_FacesFiller& FF,const TopOpeBRep_VPointInter& VP)
493 TopOpeBRepDS_Transition LineTonF1 = FaceFaceTransition(1);
494 TopOpeBRepDS_Transition LineTonF2 = FaceFaceTransition(2);
495 TopoDS_Face F1 = myF1;
496 TopoDS_Face F2 = myF2;
497 // --- check interiority of VPoint to the restrictions
498 Standard_Boolean tokeep = VP.Keep();
499 if ( !tokeep ) return;
501 Standard_Integer ShapeIndex = VP.ShapeIndex();
503 if (ShapeIndex == 0) {
504 FF.ProcessVPnotonR(VP);
506 else if (ShapeIndex == 1) {
507 FF.ProcessVPonR(VP,LineTonF1,F1,1);
509 else if (ShapeIndex == 2) {
510 FF.ProcessVPonR(VP,LineTonF2,F2,2);
512 else if (ShapeIndex == 3) {
514 Standard_Boolean isV1 = VP.IsVertexOnS1();
515 Standard_Boolean isV2 = VP.IsVertexOnS2();
517 Standard_Integer shin1 = 1;
518 if (isV2 && !isV1) shin1 = 2;
521 FF.ProcessVPonR(VP,LineTonF1,F1,1);
522 FF.ProcessVPonR(VP,LineTonF2,F2,2);
524 else if (shin1 == 2) {
525 FF.ProcessVPonR(VP,LineTonF2,F2,2);
526 FF.ProcessVPonR(VP,LineTonF1,F1,1);
531 static Standard_Boolean FUN_brep_ONfirstP(const TopOpeBRep_VPointInter& vpf, const TopOpeBRep_VPointInter& VP)
532 // prequesitory : gline is on edge
534 Standard_Real parfirst = vpf.ParameterOnLine();
535 Standard_Real parcur = VP.ParameterOnLine();
536 Standard_Real d = parcur - parfirst;
537 Standard_Real tol = Precision::Confusion(); //nyixpu051098 : see lbr...
538 Standard_Boolean ONfirstP = (Abs(d) < tol);
543 static void FUN_remove(TopOpeBRepDS_ListOfInterference& lI, const Handle(TopOpeBRepDS_Interference)& I)
545 TopOpeBRepDS_ListIteratorOfListOfInterference itI(lI);
547 const Handle(TopOpeBRepDS_Interference)& Icur = itI.Value();
548 if (Icur == I) lI.Remove(itI);
554 //=======================================================================
555 //function : ProcessRLine
557 //=======================================================================
558 void TopOpeBRep_FacesFiller::ProcessRLine()
561 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
564 if (myLine->TypeLineCurve() != TopOpeBRep_RESTRICTION) {return;}
566 Standard_Boolean addIFE = Standard_True;
569 const TopoDS_Edge& Erest = TopoDS::Edge(myLine->Arc());
570 Standard_Boolean FIisrest = myFacesIntersector->IsRestriction(Erest);
571 if (!FIisrest) return;
573 Standard_Boolean isedge1 = myLine->ArcIsEdge(1);
574 Standard_Boolean isedge2 = myLine->ArcIsEdge(2);
575 Standard_Integer EShapeIndex = (isedge1) ? 1 : (isedge2) ? 2 : 0;
577 Standard_Integer iErest = myDS->AddShape(Erest,EShapeIndex);
578 Standard_Integer rank = myDS->AncestorRank(iErest);
579 Standard_Integer OOrank = (rank == 1)? 2: 1;
582 if (tDSF) {cout<<"+ edge restriction "<<myDS->SectionEdge(Erest);
583 cout<<" (DS "<<iErest<<")"<<endl;}
584 Standard_Boolean trce = TopOpeBRepDS_GettraceSPSX(iErest); if(trce) debrest(iErest);
587 Standard_Integer iF1 = myDS->AddShape(myF1,1);
588 Standard_Integer iF2 = myDS->AddShape(myF2,2);
589 Handle(TopOpeBRepDS_Interference) IFE;
591 TopOpeBRepDS_Transition T1 = FaceFaceTransition(1); T1.Index(iF2);
592 TopOpeBRepDS_Transition T2 = FaceFaceTransition(2); T2.Index(iF1);
594 Standard_Boolean T1unk = T1.IsUnknown();
595 Standard_Boolean T2unk = T2.IsUnknown();
596 Standard_Boolean processUNK = Standard_False;
598 Standard_Boolean nopunk = TopOpeBRep_GetcontextNOPUNK();
599 if (nopunk) processUNK = Standard_False;
601 if (processUNK && (T1unk || T2unk)) {
603 Standard_Boolean trc = TopOpeBRepDS_GettraceSTRANGE(); trc = trc || tDSF;
604 if (trc) cout<<"T UNKNOWN FEI F"<<iF1<<" F"<<iF2<<" on Erest"<<iErest<<endl;
606 TopoDS_Shape F = (*this).Face(rank); Standard_Integer iF = myDS->Shape(F);
607 TopoDS_Shape OOF = (*this).Face(OOrank); Standard_Integer iOOF = myDS->Shape(OOF);
608 Standard_Boolean findTOOF = (T1unk && (OOrank == 1)) || (T2unk && (OOrank == 2));
609 Standard_Boolean findTF = (T1unk && (rank == 1)) || (T2unk && (rank == 2));
614 // ?<OOIfound> on <OOE> : OOIfound = (T, S=iF, G=POINT/VERTEX on <Erest>)
615 TopOpeBRepDS_Transition T; Standard_Boolean OOTok = FUN_findTOOF(myDS,iErest,iF,iOOF,T);
617 if (OOrank == 1) FDS_SetT(T1,T);
621 cout<<"F"<<iOOF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
622 TopAbs::Print(T.After(),cout);cout<<" (F"<<iF<<") (E"<<iErest<<"))\n";
628 // ?Ifound on <Erest> : Ifound = (T on FACE=iOOF, S, G=POINT/VERTEX on <Erest>)
629 // if <Ifound> found : compute TErest at G / <OOF>
630 TopOpeBRepDS_Transition T; Standard_Boolean Tok = FUN_findTF(myDS,iErest,iF,iOOF,T);
632 if (rank == 1) FDS_SetT(T1,T);
635 if (trc) {cout<<"F"<<iF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
636 TopAbs::Print(T.After(),cout);cout<<" (F"<<iOOF<<") (E"<<iErest<<"))\n";}
640 T1unk = T1.IsUnknown();
641 T2unk = T2.IsUnknown();
642 } // processUNK && (T1unk || T2unk)
644 IFE = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference
645 (T1,iF2,iErest,isedge1,TopOpeBRepDS_UNSHGEOMETRY);
646 myHDS->StoreInterference(IFE,iF1);
648 IFE = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference
649 (T2,iF1,iErest,isedge2,TopOpeBRepDS_UNSHGEOMETRY);
650 myHDS->StoreInterference(IFE,iF2);
652 //#################### Rline Processing ####################
654 TopOpeBRep_VPointInterIterator VPI;
656 Standard_Real tola = Precision::Angular()*1.e5;//NYIXPUTOL
661 cout<<endl<<"------------ Rline processing --------------------"<<endl;
665 const TopOpeBRep_VPointInter& vpf = VPI.CurrentVP();
666 for (; VPI.More(); VPI.Next()) {
667 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
669 if (tDSF) {cout<<endl;myHFFD->DumpVP(VP);}
671 Standard_Integer absindex = VP.ShapeIndex(); // 0,1,2,3
672 Standard_Real parRest;
673 Standard_Boolean okR = VP.ParonE(Erest,parRest);
674 if (!okR) parRest = VP.ParameterOnLine();
675 Standard_Boolean on2edges = (absindex == 3) || (absindex == OOrank);
678 // MSV: treat the case when an edge is touched by interior of a face
680 // MSV: the commented code below leads to exception on 1cto 025 H3
681 // (object and tool have same subshapes), so to enable it
682 // the debug is needed
684 // Standard_Boolean SIisvertex = VP.IsVertex(EShapeIndex);
685 // if (SIisvertex) continue;
686 // Standard_Integer ShapeIndex = EShapeIndex;
687 // Standard_Integer OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
688 // TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
689 // Standard_Integer iOOFace = myDS->Shape(OOFace);
692 // TopOpeBRepDS_Kind PVKind = TopOpeBRepDS_POINT;
693 // Standard_Integer PVIndex = 0;
694 // Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False;
695 // Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
696 // FUN_VPIndex((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL,
697 // PVKind,PVIndex,EPIfound,IEPI,CPIfound,ICPI,
699 // Standard_Boolean Efound = (EPIfound || CPIfound);
700 // Standard_Boolean Ifound = (PVIndex != 0);
701 // Standard_Boolean condmake = (!Efound && !Ifound);
703 // PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
705 // // make transition on edge
706 // TopOpeBRepDS_Transition transEdge;
707 // TopOpeBRepDS_Transition Trans = FaceFaceTransition(ShapeIndex);
708 // Standard_Boolean TransUNK = Trans.IsUnknown();
710 // TopAbs_Orientation oriErest = Erest.Orientation();
711 // transEdge = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,ShapeIndex,oriErest);
712 // TransUNK = FDS_hasUNK(transEdge);
715 // Standard_Boolean ONfirstP = ::FUN_brep_ONfirstP(vpf,VP);
716 // TopAbs_Orientation OVP = ONfirstP ? TopAbs_FORWARD : TopAbs_REVERSED;
717 // transEdge.Set(OVP);
718 // if (ONfirstP) transEdge.StateAfter(TopAbs_ON);
719 // else transEdge.StateBefore(TopAbs_ON);
720 // TransUNK = FDS_hasUNK(transEdge);
722 // if (TransUNK) continue;
724 // // see if there is already such interference in DS
725 // TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);
726 // const TopOpeBRepDS_ListOfInterference& lIedge = myHDS->DS().ShapeInterferences(Erest);
727 // TopOpeBRepDS_ListOfInterference copy; FDS_copy(lIedge,copy);
728 // TopOpeBRepDS_ListOfInterference l1,l2;
729 // Standard_Integer nfound = FUN_selectGIinterference(copy,PVIndex,l1);
731 // if (iOOFace != 0) {
732 // TopOpeBRepDS_ListOfInterference l3,l4;
733 // nfound = FUN_selectITRASHAinterference(l2,iOOFace,l3);
734 // if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
735 // if (nfound) continue;
739 // // make and store interference
740 // Handle(TopOpeBRepDS_Interference) EPIf;
741 // if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
742 // TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
743 // EPIf = MakeEPVInterference(T,iOOFace,PVIndex,parRest,PVKind,
744 // TopOpeBRepDS_FACE,SIisvertex);
745 // myHDS->StoreInterference(EPIf,Erest);
750 TopoDS_Edge OOE = TopoDS::Edge(VP.Edge(OOrank));
751 Standard_Integer iOO = myDS->AddShape(OOE,OOrank);
754 VP.ParonE(OOE,OOpar);
756 // xpu091198 : 1d interf done in EdgesFiller processing (cto cylcong *)
757 Standard_Boolean sdmeds = FUN_ds_sdm((*myDS),Erest,OOE);
758 if (sdmeds) continue;
760 Standard_Integer obRest = TopOpeBRepTool_TOOL::OnBoundary(parRest,Erest); //vertex can be missed
761 Standard_Integer obOO = TopOpeBRepTool_TOOL::OnBoundary(OOpar,OOE); //vertex can be missed
763 if ((obRest == EXTERNAL)||(obOO == EXTERNAL)){
765 if(obRest==EXTERNAL) cout<<"***********ProcessRLine : faulty parameter on Erest"<<endl;
766 if(obOO==EXTERNAL) cout<<"***********ProcessRLine : faulty parameter on OOE"<<endl;
770 Standard_Boolean tgeds = FUN_tool_EtgOOE(parRest,Erest, OOpar,OOE, tola);
772 TopOpeBRepDS_Kind PVKind = TopOpeBRepDS_POINT; Standard_Integer PVIndex = 0; // POINT or VERTEX index
774 for (Standard_Integer ShapeIndex = 1; ShapeIndex<=2; ShapeIndex++) {
775 Standard_Integer OOShapeIndex = (ShapeIndex == 1) ? 2 : 1;
776 Standard_Boolean SIErest = (ShapeIndex == rank);
778 Standard_Boolean SIisvertex = VP.IsVertex(ShapeIndex);
779 Standard_Boolean OOisvertex = VP.IsVertex(OOShapeIndex);
780 TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
781 Standard_Integer iOOFace = myDS->Shape(OOFace);
783 TopoDS_Edge edge,OOedge; Standard_Integer SIedgeIndex,OOedgeIndex;
784 Standard_Real paredge,OOparedge;
785 Standard_Integer onbound;
787 {edge = Erest; SIedgeIndex = iErest; paredge = parRest; onbound = obRest;
788 OOedge = OOE; OOedgeIndex = iOO; OOparedge = OOpar;}
790 {OOedge = Erest;OOedgeIndex = iErest; OOparedge = parRest; onbound = obOO;
791 edge = OOE; SIedgeIndex = iOO; paredge = OOpar;}
795 // xpu150399 : BUC60382
796 Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False; Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
797 ProcessVPondgE(VP, ShapeIndex,
798 PVKind,PVIndex, // out
799 EPIfound,IEPI, // out
800 CPIfound,ICPI); // out
803 // Standard_Boolean EPIfound=Standard_False,CPIfound=Standard_False; Handle(TopOpeBRepDS_Interference) IEPI,ICPI;
804 FUN_VPIndex((*this),(*myLine),VP,ShapeIndex,myHDS,myDSCIL,
805 PVKind,PVIndex,EPIfound,IEPI,CPIfound,ICPI,
807 Standard_Boolean Efound = (EPIfound || CPIfound);
808 Standard_Boolean Ifound = (PVIndex != 0);
809 Standard_Boolean condmake = (!Efound && !Ifound);
811 if ( SIisvertex ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
812 else if ( OOisvertex ) PVIndex = MakeGeometry(VP,OOShapeIndex,PVKind);
813 else PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
819 if (OOedgeIndex == 0) OOedgeIndex = myDS->AddShape(OOedge,OOShapeIndex);
820 const TopOpeBRepDS_Transition& llt1 = FaceFaceTransition(1);
821 const TopOpeBRepDS_Transition& llt2 = FaceFaceTransition(2);
822 TopOpeBRepDS_Transition Trans = (ShapeIndex == 1)? llt1 : llt2;
823 Standard_Boolean TransUNK = Trans.IsUnknown();
824 TopAbs_Orientation Transori; if (!TransUNK) Transori = Trans.Orientation(TopAbs_IN);
826 TopOpeBRepDS_Transition transEdge; Standard_Boolean Tunk = Standard_True;
827 if (!TransUNK) { //xpu281098 PRO12875(edge9,OOface11)
828 if ((absindex==ShapeIndex)||(absindex==3)) {
830 // transition on Erest at VP / OOface = transition at VP on Line restriction
831 TopAbs_Orientation oriErest = Erest.Orientation();
832 transEdge = TopOpeBRep_FFTransitionTool::ProcessLineTransition(VP,ShapeIndex,oriErest);
834 if (((onbound == 1)||(onbound == 2))&&tgeds) // xpu290399 : edge is restriction,
835 // edge15,OOedge14,OOface13
836 {transEdge.Before(TopAbs_UNKNOWN); transEdge.After(TopAbs_UNKNOWN);}
839 // transition on edge at VP / OOface ?=
840 // TopOpeBRep_FFTransitionTool::ProcessEdgeTransition(VP,ShapeIndex,Transori);
844 Tunk = FDS_hasUNK(transEdge);
848 // As edge=Erest is on OOFace, we only compute 2d interferences
849 Standard_Boolean ONfirstP = ::FUN_brep_ONfirstP(vpf,VP);
850 TopAbs_Orientation OVP = ONfirstP ? TopAbs_FORWARD : TopAbs_REVERSED;
851 TopAbs_Orientation oOO; Standard_Boolean ok = FUN_tool_orientEinFFORWARD(OOedge,OOFace,oOO);
853 if (M_INTERNAL(oOO)) OVP = TopAbs_INTERNAL;
855 // xpu240399 : cto015I2 (e15,v16)
856 // edge and OOedge are tangent, we do not keep the orientation
857 if (!tgeds) transEdge.Set(OVP);
860 TopOpeBRepDS_Transition Tr;
861 Standard_Boolean ok = FUN_newtransEdge(myHDS,(*this),(*myLine),myLineIsonEdge,VP,PVKind,PVIndex,OOShapeIndex,
864 transEdge.Before(Tr.Before()); transEdge.After(Tr.After());
867 if (tDSF) {cout<<"*-> new transEdge (edge"<<SIedgeIndex<<",face"<<iOOFace<<")=";
868 TopAbs::Print(transEdge.Before(),cout);
869 cout<<" ";TopAbs::Print(transEdge.After(),cout);cout<<endl;}
872 Tunk = FDS_hasUNK(transEdge);
875 TopAbs_Orientation otransEdge = transEdge.Orientation(TopAbs_IN);
876 const TopOpeBRepDS_ListOfInterference& lIedge = myHDS->DS().ShapeInterferences(edge);
877 TopOpeBRepDS_ListOfInterference copy; FDS_copy(lIedge,copy);
878 TopOpeBRepDS_ListOfInterference l1,l2; Standard_Integer nfound = FUN_selectGIinterference(copy,PVIndex,l1);
879 if (OOedgeIndex != 0) nfound = FUN_selectSIinterference(l1,OOedgeIndex,l2);
882 TopOpeBRepDS_ListOfInterference l3,l4; nfound = FUN_selectITRASHAinterference(l2,OOedgeIndex,l3);
883 if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
884 if (nfound) continue; // has I1d=(transEdge(OOedgeIndex),PVIndex,OOedgeIndex);
886 else if (iOOFace != 0) {
887 TopOpeBRepDS_ListOfInterference l3,l4; nfound = FUN_selectITRASHAinterference(l2,iOOFace,l3);
888 if (nfound != 0) nfound = FUN_selectTRAORIinterference(l3,otransEdge,l4);
889 if (nfound) continue; // has I2d=(transEdge(iOOFace),PVIndex,OOedgeIndex)
895 Handle(TopOpeBRepDS_Interference) EPI;
897 if (iOOFace == 0) iOOFace = myDS->AddShape(OOFace,OOShapeIndex);
898 TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
899 EPI = MakeEPVInterference(T,OOedgeIndex,PVIndex,paredge,PVKind,SIisvertex);
901 myHDS->StoreInterference(EPI,edge);
906 Handle(TopOpeBRepDS_Interference) EPIf;
907 TopOpeBRepDS_Transition T = transEdge; T.Index(iOOFace);
908 EPIf = MakeEPVInterference(T,iOOFace,PVIndex,paredge,PVKind,
909 TopOpeBRepDS_FACE,SIisvertex);
910 myHDS->StoreInterference(EPIf,edge);
915 //####################
918 static Standard_Boolean FUN_haslastvpon0(const TopOpeBRep_LineInter& L)
920 const Standard_Boolean wline = (L.TypeLineCurve() == TopOpeBRep_WALKING);
921 if (!wline) return Standard_False;
923 Standard_Integer iINON1,iINONn,nINON; L.VPBounds(iINON1,iINONn,nINON);
925 TopOpeBRep_VPointInterIterator VPI;
927 for (; VPI.More(); VPI.Next()) {
928 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
929 const Standard_Integer absindex = VP.ShapeIndex();
930 const Standard_Integer iVP = VP.Index();
931 if (iVP == iINONn && absindex == 0) return Standard_True;
933 return Standard_False;
936 //=======================================================================
937 //function : FillLineVPonR
939 //=======================================================================
940 void TopOpeBRep_FacesFiller::FillLineVPonR()
943 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
944 Standard_Boolean trline = Standard_False;
947 // if a VP is on degenerated edge, adds the triplet
948 // (vertex, closing edge, degenerated edge) to the
949 // map as vertex for key.
950 // myDataforDegenEd.Clear();
951 FUN_GetdgData(myDS,(*myLine),myF1,myF2,myDataforDegenEd);
952 FUN_FillVof12((*myLine),myDS) ;
956 if (myLine->TypeLineCurve() == TopOpeBRep_RESTRICTION) {
958 if (trline) FUN_traceRLine(*myLine);
964 Standard_Integer iINON1,iINONn,nINON;
965 myLine->VPBounds(iINON1,iINONn,nINON);
971 if (trline) FUN_traceGLine(*myLine);
974 myLineIsonEdge = LSameDomainERL(*myLine, myERL);
976 // walking (case mouch1a 1 1) : line (vpfirst on 3,vplast on 0,nvpkept = 2) => kept
977 myLastVPison0 = ::FUN_haslastvpon0(*myLine);
981 if (myLineIsonEdge) cout<<" geometric line is on edge"<<endl;
982 else cout <<" geometric line not on edge"<<endl;
986 //----------------------------------------------------------------------
988 // Some of Curve/Point transitions for vpoints keep on RESTRICTION lines
989 // sharing same domain with the current geometric line are computed here
990 //----------------------------------------------------------------------
993 Standard_Boolean trcd = Standard_False;
995 if (trcd) FUN_DrawMap(myDataforDegenEd);
999 TopOpeBRep_VPointInterIterator VPI;
1000 VPI.Init((*myLine));
1001 for (; VPI.More(); VPI.Next()) {
1002 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
1003 ProcessVPR((*this),VP);
1006 if ( myLineIsonEdge && (!myDSCIL.IsEmpty()) ) {
1008 if (tDSF) cout<<"myLineIsonEdge && (!myDSCIL.IsEmpty())"<<endl;
1014 //=======================================================================
1015 //function : FillLine
1017 //=======================================================================
1018 void TopOpeBRep_FacesFiller::FillLine()
1021 Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
1024 Standard_Integer iINON1,iINONn,nINON;
1025 myLine->VPBounds(iINON1,iINONn,nINON);
1026 if ( nINON == 0 ) return;
1028 Standard_Integer ShapeIndex = 0;
1029 Handle(TopOpeBRepDS_Interference) CPI;
1031 TopOpeBRep_VPointInterIterator VPI;
1032 for (VPI.Init((*myLine)); VPI.More(); VPI.Next()) {
1034 const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
1035 if ( ! VP.Keep() ) continue;
1038 if (tDSF) cout<<endl;
1041 Standard_Integer PVIndex;
1042 TopOpeBRepDS_Kind PVKind;
1043 TopOpeBRepDS_ListIteratorOfListOfInterference itCPIL(myDSCIL);
1044 Standard_Boolean CPIfound;
1045 CPIfound = GetGeometry(itCPIL,VP,PVIndex,PVKind);
1047 Standard_Boolean found = GetFFGeometry(VP,PVKind,PVIndex);
1048 if ( !found ) PVIndex = MakeGeometry(VP,ShapeIndex,PVKind);
1051 TopOpeBRepDS_Transition transLine;
1053 Standard_Integer iVP = VPI.CurrentVPIndex();
1054 if (iVP == iINON1) transLine.Set(TopAbs_FORWARD);
1055 else if (iVP == iINONn) transLine.Set(TopAbs_REVERSED);
1057 else transLine = itCPIL.Value()->Transition().Complement();
1059 Standard_Real parline = VPI.CurrentVP().ParameterOnLine();
1060 CPI = TopOpeBRepDS_InterferenceTool::MakeCurveInterference
1061 (transLine,TopOpeBRepDS_CURVE,0,PVKind,PVIndex,parline);
1062 StoreCurveInterference(CPI);
1064 } // loop on VPoints
1068 //=======================================================================
1069 //function : AddShapesLine
1071 //=======================================================================
1072 void TopOpeBRep_FacesFiller::AddShapesLine()
1074 Standard_Boolean dscilemp = myDSCIL.IsEmpty();
1075 if (dscilemp) return;
1077 Standard_Boolean inl = myLine->INL();
1080 TopOpeBRepDS_Curve& DSC = myDS->ChangeCurve(myDSCIndex);
1082 Handle(Geom_Curve) C3D;
1083 Handle(Geom2d_Curve) PC1,PC2;
1084 Handle(TopOpeBRepDS_Interference) FCI1, FCI2;
1086 Standard_Integer iF1 = myDS->AddShape(myF1,1);
1087 Standard_Integer iF2 = myDS->AddShape(myF2,2);
1089 Standard_Real pmin,pmax;
1090 myHDS->MinMaxOnParameter(myDSCIL,pmin,pmax);
1092 Standard_Real d = Abs(pmin-pmax);
1093 Standard_Boolean id = (d <= Precision::PConfusion());
1094 Standard_Boolean isper = myLine->IsPeriodic();
1095 id = (id && !isper);
1097 Standard_Boolean wline = (myLine->TypeLineCurve() == TopOpeBRep_WALKING);
1098 Standard_Boolean vclosed = myLine->IsVClosed();
1099 if (wline && !isper && vclosed) {
1100 //xpu240399 : USA60298 : avoid creating curve
1101 // MSV: take into account that geometry can be of type VERTEX
1102 Standard_Integer ipf = myDSCIL.First()->Geometry();
1103 TopOpeBRepDS_Kind kpf = myDSCIL.First()->GeometryType();
1105 Standard_Real tol,tolf, toll;
1106 if (kpf == TopOpeBRepDS_POINT) {
1107 TopOpeBRepDS_Point pf = myDS->Point(ipf);
1109 tolf = pf.Tolerance();
1112 TopoDS_Vertex vf = TopoDS::Vertex(myDS->Shape(ipf));
1113 ptf = BRep_Tool::Pnt(vf);
1114 tolf = BRep_Tool::Tolerance(vf);
1117 Standard_Integer ipl = myDSCIL.Last()->Geometry();
1118 TopOpeBRepDS_Kind kpl = myDSCIL.Last()->GeometryType();
1119 if (kpl == TopOpeBRepDS_POINT) {
1120 TopOpeBRepDS_Point pl = myDS->Point(ipl);
1121 toll = pl.Tolerance();
1124 TopoDS_Vertex vl = TopoDS::Vertex(myDS->Shape(ipl));
1125 toll = BRep_Tool::Tolerance(vl);
1128 tol = Max(tolf, toll);
1129 Standard_Boolean onsampt = Standard_True;
1130 for (Standard_Integer ii = 1; ii <= myLine->NbWPoint(); ii++) {
1131 TopOpeBRep_WPointInter wp = myLine->WPoint(ii);
1132 gp_Pnt pp = wp.Value();
1133 if (!pp.IsEqual(ptf,tol)) {onsampt = Standard_False;break;}
1135 if (onsampt) id = Standard_True;
1139 if (TopOpeBRepDS_GettraceDSF()) {
1140 cout<<endl<<"minmax "<<pmin<<","<<pmax;
1141 if (id) cout<<" --> rejet";
1147 DSC.ChangeKeep(Standard_False);
1151 TopOpeBRep_GeomTool::MakeCurves(pmin,pmax,(*myLine),myF1,myF2,DSC,PC1,PC2);
1153 //Patch: avoid making too small edges. Made for the bug buc60926 by jgv, 14.06.01.
1154 Standard_Real fpar, lpar;
1155 DSC.Range(fpar, lpar);
1156 GeomAdaptor_Curve theCurve( DSC.Curve(), fpar, lpar );
1158 BndLib_Add3dCurve::Add( theCurve, 0., theBox );
1159 Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax, MaxSide;
1160 theBox.Get( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
1161 MaxSide = Max( Max(Xmax-Xmin, Ymax-Ymin), Zmax-Zmin );
1162 Standard_Real MinTol = Min( BRep_Tool::Tolerance(myF1), BRep_Tool::Tolerance(myF2) );
1163 if (MaxSide < MinTol)
1165 DSC.ChangeKeep(Standard_False);
1169 Standard_Real tolDSC = 1.e-8;
1170 DSC.Tolerance(tolDSC);
1171 const TopOpeBRepDS_Transition& lllt1 = FaceFaceTransition(1);
1172 const TopOpeBRepDS_Transition& lllt2 = FaceFaceTransition(2);
1174 myDS->ChangeCurveInterferences(myDSCIndex).Append(myDSCIL);
1176 TopOpeBRepDS_Transition T1 = lllt1; T1.Index(iF2);
1177 FCI1 = TopOpeBRepDS_InterferenceTool::MakeFaceCurveInterference
1178 (T1,iF2,myDSCIndex,PC1);
1179 myHDS->StoreInterference(FCI1,myF1);
1183 TopOpeBRepDS_Transition T2 = lllt2; T2.Index(iF1);
1184 FCI2 = TopOpeBRepDS_InterferenceTool::MakeFaceCurveInterference
1185 (T2,iF1,myDSCIndex,PC2);
1186 myHDS->StoreInterference(FCI2,myF2);
1189 DSC.SetShapes(myF1,myF2);
1190 DSC.SetSCI(FCI1,FCI2);
1194 //=======================================================================
1195 //function : StoreCurveInterference
1197 //=======================================================================
1198 void TopOpeBRep_FacesFiller::StoreCurveInterference(const Handle(TopOpeBRepDS_Interference)& I)
1200 if ( myDSCIndex == 0 ) {
1201 TopOpeBRepDS_Curve DSC;
1202 myDSCIndex = myDS->AddCurve(DSC);
1205 if (TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSNC())
1206 cout<<"new DSC "<<myDSCIndex<<endl;
1207 if (TopOpeBRepDS_GettraceDSLT()) myLine->DumpLineTransitions(cout);
1211 I->Support(myDSCIndex);
1212 myHDS->StoreInterference(I,myDSCIL);
1215 //=======================================================================
1216 //function : GetGeometry
1218 //=======================================================================
1219 Standard_Boolean TopOpeBRep_FacesFiller::GetGeometry(TopOpeBRepDS_ListIteratorOfListOfInterference& IT,const TopOpeBRep_VPointInter& VP,Standard_Integer& G,TopOpeBRepDS_Kind& K)
1221 TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(VP);
1222 Standard_Boolean b = myHDS->GetGeometry(IT,DSP,G,K);
1224 Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
1226 Standard_Boolean newinDS = Standard_False; myHFFD->DumpDSP(VP,K,G,newinDS);
1232 //=======================================================================
1233 //function : MakeGeometry
1235 //=======================================================================
1236 Standard_Integer TopOpeBRep_FacesFiller::MakeGeometry(const TopOpeBRep_VPointInter& VP,const Standard_Integer ShapeIndex,TopOpeBRepDS_Kind& K)
1239 Standard_Boolean isvertex = VP.IsVertex(ShapeIndex);
1241 const TopoDS_Shape& S = VP.Vertex(ShapeIndex);
1242 G = myDS->AddShape(S,ShapeIndex);
1243 K = TopOpeBRepDS_VERTEX;
1246 TopOpeBRepDS_Point P = TopOpeBRep_PointGeomTool::MakePoint(VP);
1247 G = myDS->AddPoint(P);
1248 K = TopOpeBRepDS_POINT;
1252 Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
1254 Standard_Boolean newinDS = Standard_True; myHFFD->DumpDSP(VP,K,G,newinDS);
1261 //=======================================================================
1262 //function : GetFFGeometry
1264 //=======================================================================
1265 Standard_Boolean TopOpeBRep_FacesFiller::GetFFGeometry(const TopOpeBRepDS_Point& DSP,TopOpeBRepDS_Kind& K,Standard_Integer& G) const
1267 Standard_Boolean found = Standard_False;
1268 Standard_Integer i = myFFfirstDSP, n = myDS->NbPoints();
1269 for (; i <= n; i++) {
1270 const TopOpeBRepDS_Point& OODSP = myDS->Point(i);
1271 found = TopOpeBRep_PointGeomTool::IsEqual(DSP,OODSP);
1275 K = TopOpeBRepDS_POINT;
1281 //=======================================================================
1282 //function : GetFFGeometry
1284 //=======================================================================
1285 Standard_Boolean TopOpeBRep_FacesFiller::GetFFGeometry(const TopOpeBRep_VPointInter& VP,TopOpeBRepDS_Kind& K,Standard_Integer& G) const
1287 TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(VP);
1288 Standard_Integer found = GetFFGeometry(DSP,K,G);