1 // Created on: 1995-11-10
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1995-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.
24 #include <BRepAlgo_Loop.ixx>
26 #include <BRep_Builder.hxx>
27 #include <BRepAlgo_FaceRestrictor.hxx>
28 #include <BRep_Tool.hxx>
30 #include <Geom2d_Curve.hxx>
31 #include <Geom_Surface.hxx>
33 #include <TopTools_SequenceOfShape.hxx>
34 #include <TopTools_MapOfShape.hxx>
35 #include <TopTools_ListIteratorOfListOfShape.hxx>
36 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
39 #include <TopoDS_Vertex.hxx>
40 #include <TopoDS_Wire.hxx>
42 #include <gp_Pnt2d.hxx>
43 #include <Precision.hxx>
44 #include <BRep_TVertex.hxx>
45 #include <BRep_TEdge.hxx>
46 #include <TopExp_Explorer.hxx>
47 #include <TopoDS_Iterator.hxx>
48 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
54 Standard_Boolean AffichLoop = Standard_False;
55 Standard_Integer NbLoops = 0;
56 Standard_Integer NbWires = 1;
57 static char* name = new char[100];
60 //=======================================================================
61 //function : BRepAlgo_Loop
63 //=======================================================================
65 BRepAlgo_Loop::BRepAlgo_Loop()
70 //=======================================================================
73 //=======================================================================
75 void BRepAlgo_Loop::Init(const TopoDS_Face& F)
86 //=======================================================================
88 //purpose : Orders the sequence of vertices by increasing parameter.
89 //=======================================================================
91 static void Bubble(const TopoDS_Edge& E,
92 TopTools_SequenceOfShape& Seq)
94 Standard_Boolean Invert = Standard_True;
95 Standard_Integer NbPoints = Seq.Length();
100 Invert = Standard_False;
101 for ( Standard_Integer i = 1; i < NbPoints; i++) {
102 TopoDS_Shape aLocalV = Seq.Value(i) .Oriented(TopAbs_INTERNAL);
103 V1 = TopoDS::Vertex(aLocalV);
104 aLocalV = Seq.Value(i+1).Oriented(TopAbs_INTERNAL);
105 V2 = TopoDS::Vertex(aLocalV);
106 // V1 = TopoDS::Vertex(Seq.Value(i) .Oriented(TopAbs_INTERNAL));
107 // V2 = TopoDS::Vertex(Seq.Value(i+1).Oriented(TopAbs_INTERNAL));
109 U1 = BRep_Tool::Parameter(V1,E);
110 U2 = BRep_Tool::Parameter(V2,E);
113 Invert = Standard_True;
121 //=======================================================================
122 //function : AddEdges
124 //=======================================================================
126 void BRepAlgo_Loop::AddEdge (TopoDS_Edge& E,
127 const TopTools_ListOfShape& LV)
129 myVerOnEdges.Bind(E,LV);
133 //=======================================================================
134 //function : AddConstEdges
136 //=======================================================================
138 void BRepAlgo_Loop::AddConstEdge (const TopoDS_Edge& E)
140 myConstEdges.Append(E);
143 //=======================================================================
144 //function : AddConstEdges
146 //=======================================================================
148 void BRepAlgo_Loop::AddConstEdges(const TopTools_ListOfShape& LE)
150 TopTools_ListIteratorOfListOfShape itl(LE);
151 for (; itl.More(); itl.Next()) {
152 myConstEdges.Append(itl.Value());
157 //=======================================================================
158 //function : UpdateClosedEdge
159 //purpose : If the first or the last vertex of intersection
160 // coincides with the closing vertex, it is removed from SV.
161 // it will be added at the beginning and the end of SV by the caller.
162 //=======================================================================
164 static TopoDS_Vertex UpdateClosedEdge(const TopoDS_Edge& E,
165 TopTools_SequenceOfShape& SV)
167 TopoDS_Vertex VB [2], V1, V2, VRes;
169 Standard_Boolean OnStart = 0, OnEnd = 0;
170 //// modified by jgv, 13.04.04 for OCC5634 ////
171 TopExp::Vertices (E,V1,V2);
172 //Standard_Real Tol = Precision::Confusion();
173 Standard_Real Tol = BRep_Tool::Tolerance( V1 );
174 ///////////////////////////////////////////////
176 if (SV.IsEmpty()) return VRes;
178 VB[0] = TopoDS::Vertex(SV.First());
179 VB[1] = TopoDS::Vertex(SV.Last ());
180 PC = BRep_Tool::Pnt(V1);
182 for ( Standard_Integer i = 0 ; i < 2 ; i++) {
183 P = BRep_Tool::Pnt(VB [i]);
184 if (P.IsEqual(PC,Tol)) {
186 if (i == 0) OnStart = Standard_True;
187 else OnEnd = Standard_True;
190 if (OnStart && OnEnd) {
191 if (!VB[0].IsSame(VB[1])) {
194 cout <<"Two different vertices on the closing vertex"<<endl;
199 if (!SV.IsEmpty()) SV.Remove(SV.Length());
202 else if (OnStart) SV.Remove(1);
203 else if (OnEnd ) SV.Remove(SV.Length());
210 //=======================================================================
211 //function : RemovePendingEdges
213 //=======================================================================
215 static void RemovePendingEdges(TopTools_DataMapOfShapeListOfShape& MVE)
217 //--------------------------------
218 // Remove hanging edges.
219 //--------------------------------
220 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit;
221 TopTools_ListOfShape ToRemove;
222 TopTools_ListIteratorOfListOfShape itl;
223 Standard_Boolean YaSupress = Standard_True;
227 YaSupress = Standard_False;
228 TopTools_ListOfShape VToRemove;
229 TopTools_MapOfShape EToRemove;
231 for (Mapit.Initialize(MVE); Mapit.More(); Mapit.Next()) {
233 if (Mapit.Value().IsEmpty()) {
234 VToRemove.Append(Mapit.Key());
236 if (Mapit.Value().Extent() == 1) {
237 const TopoDS_Edge& E = TopoDS::Edge(Mapit.Value().First());
238 TopExp::Vertices(E,V1,V2) ;
239 if (!V1.IsSame(V2)) {
240 VToRemove.Append(Mapit.Key());
241 EToRemove.Add(Mapit.Value().First());
246 if (!VToRemove.IsEmpty()) {
247 YaSupress = Standard_True;
248 for (itl.Initialize(VToRemove); itl.More(); itl.Next()) {
249 MVE.UnBind(itl.Value());
251 if (!EToRemove.IsEmpty()) {
252 for (Mapit.Initialize(MVE); Mapit.More(); Mapit.Next()) {
253 TopTools_ListOfShape& LE = MVE.ChangeFind(Mapit.Key());
256 if (EToRemove.Contains(itl.Value())) {
266 //=======================================================================
267 //function : SamePnt2d
269 //=======================================================================
271 static Standard_Boolean SamePnt2d(TopoDS_Vertex V,
276 Standard_Real f1,f2,l1,l2;
278 TopoDS_Shape aLocalF = F.Oriented(TopAbs_FORWARD);
279 TopoDS_Face FF = TopoDS::Face(aLocalF);
280 // TopoDS_Face FF = TopoDS::Face(F.Oriented(TopAbs_FORWARD));
281 Handle(Geom2d_Curve) C1 = BRep_Tool::CurveOnSurface(E1,FF,f1,l1);
282 Handle(Geom2d_Curve) C2 = BRep_Tool::CurveOnSurface(E2,FF,f2,l2);
283 if (E1.Orientation () == TopAbs_FORWARD) P1 = C1->Value(f1);
284 else P1 = C1->Value(l1);
286 if (E2.Orientation () == TopAbs_FORWARD) P2 = C2->Value(l2);
287 else P2 = C2->Value(f2);
288 Standard_Real Tol = 100*BRep_Tool::Tolerance(V);
289 Standard_Real Dist = P1.Distance(P2);
293 //=======================================================================
294 //function : SelectEdge
295 //purpose : Find edge <NE> connected to <CE> by vertex <CV> in the
296 // list <LE>. <NE> is removed from the list. If <CE> is
297 // also in the list <LE> with the same orientation, it is
298 // removed from the list.
299 //=======================================================================
301 static Standard_Boolean SelectEdge(const TopoDS_Face& F,
302 const TopoDS_Edge& CE,
303 const TopoDS_Vertex& CV,
305 TopTools_ListOfShape& LE)
307 TopTools_ListIteratorOfListOfShape itl;
311 if ( LE.Extent() > 2) {
312 cout <<"vertex on more than 2 edges in a face."<<endl;
316 for ( itl.Initialize(LE); itl.More(); itl.Next()) {
317 if (itl.Value().IsEqual(CE)) {
322 if (LE.Extent() > 1) {
323 //--------------------------------------------------------------
324 // Several edges possible.
325 // - Test edges different from CE , Selection of edge
326 // for which CV has U,V closer to the face
327 // than corresponding to CE.
328 // - If several edges give representation less than the tolerance.
329 // discrimination on tangents.
330 //--------------------------------------------------------------
333 TopoDS_Face FForward = F;
334 FForward.Orientation(TopAbs_FORWARD);
336 Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(CE,FForward,f,l);
337 Standard_Integer k = 1, kmin = 0;
338 Standard_Real dist,distmin = 100*BRep_Tool::Tolerance(CV);
340 if (CE.Orientation () == TopAbs_FORWARD) u = l;
343 gp_Pnt2d P2,PV = C->Value(u);
345 for ( itl.Initialize(LE); itl.More(); itl.Next()) {
346 const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
348 C = BRep_Tool::CurveOnSurface(E,FForward,f,l);
349 if (E.Orientation () == TopAbs_FORWARD) u = f;
352 dist = PV.Distance(P2);
353 if ( dist <= distmin) {
360 if (kmin == 0) return Standard_False;
362 k = 1; itl.Initialize(LE);
363 while (k < kmin) {k++; itl.Next();}
364 NE = TopoDS::Edge(itl.Value());
367 else if (LE.Extent() == 1) {
368 NE = TopoDS::Edge(LE.First());
372 return Standard_False;
376 DBRep::Set("Selected",NE);
380 return Standard_True;
382 //=======================================================================
385 //=======================================================================
387 static void PurgeNewEdges(TopTools_DataMapOfShapeListOfShape& NewEdges,
388 const TopTools_MapOfShape& UsedEdges)
390 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape it(NewEdges);
391 for (; it.More(); it.Next()) {
392 TopTools_ListOfShape& LNE = NewEdges.ChangeFind(it.Key());
393 TopTools_ListIteratorOfListOfShape itL(LNE);
395 const TopoDS_Shape& NE = itL.Value();
396 if (!UsedEdges.Contains(NE)) {
407 //=======================================================================
410 //=======================================================================
412 static void StoreInMVE (const TopoDS_Face& F,
414 TopTools_DataMapOfShapeListOfShape& MVE,
415 Standard_Boolean& YaCouture,
416 TopTools_DataMapOfShapeShape& VerticesForSubstitute )
418 TopoDS_Vertex V1, V2, V;
419 TopTools_ListOfShape Empty;
421 Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
424 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit;
426 for (Mapit.Initialize( MVE ); Mapit.More(); Mapit.Next())
428 V = TopoDS::Vertex( Mapit.Key() );
429 P = BRep_Tool::Pnt( V );
430 TopTools_ListOfShape VList;
431 TopoDS_Iterator VerExp( E );
432 for (; VerExp.More(); VerExp.Next())
433 VList.Append( VerExp.Value() );
434 TopTools_ListIteratorOfListOfShape itl( VList );
435 for (; itl.More(); itl.Next())
437 V1 = TopoDS::Vertex( itl.Value() );
438 P1 = BRep_Tool::Pnt( V1 );
439 if (P.IsEqual( P1, Tol ) && !V.IsSame(V1))
441 V.Orientation( V1.Orientation() );
442 if (VerticesForSubstitute.IsBound( V1 ))
444 TopoDS_Shape OldNewV = VerticesForSubstitute( V1 );
445 if (! OldNewV.IsSame( V ))
447 VerticesForSubstitute.Bind( OldNewV, V );
448 VerticesForSubstitute( V1 ) = V;
453 if (VerticesForSubstitute.IsBound( V ))
455 TopoDS_Shape NewNewV = VerticesForSubstitute( V );
456 if (! NewNewV.IsSame( V1 ))
457 VerticesForSubstitute.Bind( V1, NewNewV );
461 VerticesForSubstitute.Bind( V1, V );
462 TopTools_DataMapIteratorOfDataMapOfShapeShape mapit( VerticesForSubstitute );
463 for (; mapit.More(); mapit.Next())
464 if (mapit.Value().IsSame( V1 ))
465 VerticesForSubstitute( mapit.Key() ) = V;
468 E.Free( Standard_True );
475 TopExp::Vertices(E,V1,V2);
476 if( V1.IsNull() && V2.IsNull() ){ YaCouture = Standard_False; return; }
477 if (!MVE.IsBound(V1)) {
481 if (!V1.IsSame(V2)) {
482 if (!MVE.IsBound(V2)) {
488 Handle(Geom_Surface) S = BRep_Tool::Surface(F,L);
489 if (BRep_Tool::IsClosed(E,S,L)) {
490 MVE(V2).Append(E.Reversed());
491 if (!V1.IsSame(V2)) {
492 MVE(V1).Append(E.Reversed());
494 YaCouture = Standard_True;
498 //=======================================================================
501 //=======================================================================
503 void BRepAlgo_Loop::Perform()
505 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape Mapit;
506 TopTools_ListIteratorOfListOfShape itl;
508 Standard_Boolean YaCouture = Standard_False;
512 cout <<"NewLoop"<<endl;
513 Standard_Integer NbEdges = 1;
516 sprintf(name,"FLoop_%d",NbLoops);
517 DBRep::Set(name,myFace);
519 for (Mapit.Initialize(myVerOnEdges); Mapit.More(); Mapit.Next()) {
520 const TopoDS_Edge& E = TopoDS::Edge(Mapit.Key());
522 sprintf(name,"EEE_%d_%d",NbLoops,NbEdges++);
526 for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) {
527 const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
529 sprintf(name,"EEE_%d_%d",NbLoops,NbEdges++);
535 //------------------------------------------------
537 //------------------------------------------------
538 for (Mapit.Initialize(myVerOnEdges); Mapit.More(); Mapit.Next()) {
539 TopTools_ListOfShape LCE;
541 CutEdge (TopoDS::Edge(Mapit.Key()),Mapit.Value(), LCE);
543 myNewEdges.Bind(Mapit.Key(),LCE);
545 //-----------------------------------
546 // Construction map vertex => edges
547 //-----------------------------------
548 TopTools_DataMapOfShapeListOfShape MVE;
551 for (Mapit.Initialize(myNewEdges); Mapit.More(); Mapit.Next()) {
552 for (itl.Initialize(myNewEdges(Mapit.Key())); itl.More(); itl.Next()) {
553 TopoDS_Edge& E = TopoDS::Edge(itl.Value());
554 StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
559 // Sewn edges can be doubled or not in myConstEdges
560 // => call only once StoreInMVE which should double them
561 TopTools_MapOfShape DejaVu;
562 for (itl.Initialize(myConstEdges); itl.More(); itl.Next()) {
563 TopoDS_Edge& E = TopoDS::Edge(itl.Value());
565 StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute);
570 cout <<"NewLoop"<<endl;
571 Standard_Integer NbEdges = 1;
572 TopTools_MapOfShape Done;
573 for (Mapit.Initialize(MVE); Mapit.More();Mapit.Next()) {
574 for (itl.Initialize(Mapit.Value()); itl.More(); itl.Next()) {
575 TopoDS_Edge& E = TopoDS::Edge(itl.Value());
577 sprintf(name,"EEC_%d_%d",NbLoops,NbEdges++);
585 //-----------------------------------------------
586 // Construction of wires and new faces.
587 //----------------------------------------------
588 TopoDS_Vertex VF,VL,CV;
589 TopoDS_Edge CE,NE,EF;
592 Standard_Boolean End;
594 TopTools_MapOfShape UsedEdges;
596 while (!MVE.IsEmpty()) {
598 //--------------------------------
599 // Removal of hanging edges.
600 //--------------------------------
601 RemovePendingEdges(MVE);
603 if (MVE.IsEmpty()) break;
604 //--------------------------------
606 //--------------------------------
607 Mapit.Initialize(MVE);
608 EF = CE = TopoDS::Edge(Mapit.Value().First());
609 TopExp::Vertices(CE,V1,V2);
610 //--------------------------------
611 // VF vertex start of new wire
612 //--------------------------------
613 if (CE.Orientation() == TopAbs_FORWARD) { CV = VF = V1;}
614 else { CV = VF = V2;}
615 if (!MVE.IsBound(CV)) continue;
616 for ( itl.Initialize(MVE(CV)); itl.More(); itl.Next()) {
617 if (itl.Value().IsEqual(CE)) {
622 End = Standard_False;
625 //-------------------------------
626 // Construction of a wire.
627 //-------------------------------
628 TopExp::Vertices(CE,V1,V2);
629 if (!CV.IsSame(V1)) CV = V1; else CV = V2;
634 if (!MVE.IsBound(CV) || MVE(CV).IsEmpty()) {
638 End = !SelectEdge(myFace,CE,CV,NE,MVE(CV));
641 if (MVE(CV).IsEmpty()) MVE.UnBind(CV);
645 //--------------------------------------------------
646 // Add new wire to the set of wires
647 //------------------------------------------------
648 Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
649 TopExp_Explorer explo( NW, TopAbs_VERTEX );
650 for (; explo.More(); explo.Next())
652 const TopoDS_Vertex& aV = TopoDS::Vertex( explo.Current() );
653 Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &(aV).TShape());
654 TV->Tolerance( Tol );
655 TV->Modified( Standard_True );
657 for (explo.Init( NW, TopAbs_EDGE ); explo.More(); explo.Next())
659 const TopoDS_Edge& aE = TopoDS::Edge( explo.Current() );
660 Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &(aE).TShape());
661 TE->Tolerance( Tol );
662 TE->Modified( Standard_True );
665 if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
666 myNewWires.Append (NW);
669 cout <<"BRepAlgo_Loop: Open Wire"<<endl;
671 cout << "OpenWire is : NW_"<<NbLoops<<"_"<<NbWires<<endl;
676 sprintf(name,"NW_%d_%d",NbLoops,NbWires++);
682 PurgeNewEdges(myNewEdges,UsedEdges);
685 //=======================================================================
686 //function : CutEdges
688 //=======================================================================
690 void BRepAlgo_Loop::CutEdge (const TopoDS_Edge& E,
691 const TopTools_ListOfShape& VOnE,
692 TopTools_ListOfShape& NE ) const
694 TopoDS_Shape aLocalE = E.Oriented(TopAbs_FORWARD);
695 TopoDS_Edge WE = TopoDS::Edge(aLocalE);
699 TopTools_SequenceOfShape SV;
700 TopTools_ListIteratorOfListOfShape it(VOnE);
703 for ( ; it.More(); it.Next()) {
704 SV.Append(it.Value());
706 //--------------------------------
707 // Parse vertices on the edge.
708 //--------------------------------
711 Standard_Integer NbVer = SV.Length();
712 //----------------------------------------------------------------
713 // Construction of new edges.
714 // Note : vertices at the extremities of edges are not
715 // onligatorily in the list of vertices
716 //----------------------------------------------------------------
723 BRep_Tool::Range(WE,f,l);
724 TopExp::Vertices(WE,VF,VL);
727 if (SV(1).IsEqual(VF) && SV(2).IsEqual(VL)) {
731 DBRep::Set("ECOpied",E);
737 //----------------------------------------------------
738 // Processing of closed edges
739 // If a vertex of intersection is on the common vertex
740 // it should appear at the beginning and end of SV.
741 //----------------------------------------------------
743 if (!VF.IsNull() && VF.IsSame(VL)) {
744 VCEI = UpdateClosedEdge(WE,SV);
745 if (!VCEI.IsNull()) {
746 TopoDS_Shape aLocalV = VCEI.Oriented(TopAbs_FORWARD);
747 VF = TopoDS::Vertex(aLocalV);
748 aLocalV = VCEI.Oriented(TopAbs_REVERSED);
749 VL = TopoDS::Vertex(aLocalV);
750 // VF = TopoDS::Vertex(VCEI.Oriented(TopAbs_FORWARD));
751 // VL = TopoDS::Vertex(VCEI.Oriented(TopAbs_REVERSED));
757 //-----------------------------------------
758 // Eventually all extremities of the edge.
759 //-----------------------------------------
760 if (!VF.IsNull() && !VF.IsSame(SV.First())) SV.Prepend(VF);
761 if (!VL.IsNull() && !VL.IsSame(SV.Last ())) SV.Append (VL);
764 while (!SV.IsEmpty()) {
765 while (!SV.IsEmpty() &&
766 SV.First().Orientation() != TopAbs_FORWARD) {
771 V1 = TopoDS::Vertex(SV.First());
775 if (SV.First().Orientation() == TopAbs_REVERSED) {
776 V2 = TopoDS::Vertex(SV.First());
778 //-------------------------------------------
779 // Copy the edge and restriction by V1 V2.
780 //-------------------------------------------
781 TopoDS_Shape NewEdge = WE.EmptyCopied();
782 TopoDS_Shape aLocalEdge = V1.Oriented(TopAbs_FORWARD);
783 B.Add (NewEdge,aLocalEdge);
784 aLocalEdge = V2.Oriented(TopAbs_REVERSED);
785 B.Add (TopoDS::Edge(NewEdge),aLocalEdge);
786 // B.Add (NewEdge,V1.Oriented(TopAbs_FORWARD));
787 // B.Add (NewEdge,V2.Oriented(TopAbs_REVERSED));
791 // U1=BRep_Tool::Parameter
792 // (TopoDS::Vertex(V1.Oriented(TopAbs_INTERNAL)),WE);
794 TopoDS_Shape aLocalV = V1.Oriented(TopAbs_INTERNAL);
795 U1=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
801 TopoDS_Shape aLocalV = V2.Oriented(TopAbs_INTERNAL);
802 U2=BRep_Tool::Parameter(TopoDS::Vertex(aLocalV),WE);
803 // U2=BRep_Tool::Parameter
804 // (TopoDS::Vertex(V2.Oriented(TopAbs_INTERNAL)),WE);
806 B.Range (TopoDS::Edge(NewEdge),U1,U2);
809 DBRep::Set("Cut",NewEdge);
812 NE.Append(NewEdge.Oriented(E.Orientation()));
816 //Remove edges with size <= tolerance
817 Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
821 // skl : I change "E" to "EE"
822 TopoDS_Edge EE = TopoDS::Edge( it.Value() );
823 Standard_Real fpar, lpar;
824 BRep_Tool::Range( EE, fpar, lpar );
825 if (lpar - fpar <= Precision::Confusion())
830 BRep_Tool::UVPoints( EE, myFace, pf, pl );
831 if (pf.Distance(pl) <= Tol && !EE.Closed())
839 //=======================================================================
840 //function : NewWires
842 //=======================================================================
844 const TopTools_ListOfShape& BRepAlgo_Loop::NewWires() const
849 //=======================================================================
850 //function : NewFaces
852 //=======================================================================
854 const TopTools_ListOfShape& BRepAlgo_Loop::NewFaces() const
859 //=======================================================================
860 //function : WiresToFaces
862 //=======================================================================
864 void BRepAlgo_Loop::WiresToFaces()
866 if (!myNewWires.IsEmpty()) {
867 BRepAlgo_FaceRestrictor FR;
868 TopoDS_Shape aLocalS = myFace.Oriented(TopAbs_FORWARD);
869 FR.Init (TopoDS::Face(aLocalS),Standard_False);
870 // FR.Init (TopoDS::Face(myFace.Oriented(TopAbs_FORWARD)),
872 TopTools_ListIteratorOfListOfShape it(myNewWires);
873 for (; it.More(); it.Next()) {
874 FR.Add(TopoDS::Wire(it.Value()));
880 TopAbs_Orientation OriF = myFace.Orientation();
881 for (; FR.More(); FR.Next()) {
882 myNewFaces.Append(FR.Current().Oriented(OriF));
889 //=======================================================================
890 //function : NewEdges
892 //=======================================================================
894 const TopTools_ListOfShape& BRepAlgo_Loop::NewEdges(const TopoDS_Edge& E) const
896 return myNewEdges(E);
899 //=======================================================================
900 //function : GetVerticesForSubstitute
902 //=======================================================================
904 void BRepAlgo_Loop::GetVerticesForSubstitute( TopTools_DataMapOfShapeShape& VerVerMap ) const
906 VerVerMap = myVerticesForSubstitute;
908 //=======================================================================
909 //function : VerticesForSubstitute
911 //=======================================================================
913 void BRepAlgo_Loop::VerticesForSubstitute( TopTools_DataMapOfShapeShape& VerVerMap )
915 myVerticesForSubstitute = VerVerMap;