-
Notifications
You must be signed in to change notification settings - Fork 541
Description
Description
When attempting to merge coplanar faces using ShapeUpgrade_UnifySameDomain, the process enters an infinite loop inside ShapeUpgrade_UnifySameDomain::IntUnifyFaces.
This results in continuously increasing memory consumption until overflow. That the input shape is not closed.
Adding RemoveEdgeFromMap(anEdge, IntVEmap) after InternalEdges.RemoveKey(anEdge) in the sample code reported below ensures termination of the loop, by eliminating the visited edge not only from the InternalEdges collection but also form the IntVEmap.
Expected Behavior
The loop in IntUnifyFaces terminates.
Actual Behavior
The loop in IntUnifyFaces never terminates. Memory usage grows linearly over time.
Sample Code or DRAW Tcl Script
// The calling code
ShapeUpgrade_UnifySameDomain unification(shape);
ununification.SetAngularTolerance(1e-6);
unification.SetLinearTolerance(1e-5);
unification.AllowInternalEdges(Standard_True);
unification.Build();
// The infinite loop in ShapeUpgrade_UnifySameDomain::IntUnifyFaces
while (!InternalEdges.IsEmpty())
{
TopoDS_Edge aFirstEdge = TopoDS::Edge(InternalEdges(1));
InternalEdges.RemoveFromIndex(1);
TopoDS_Wire anInternalWire;
BB.MakeWire(anInternalWire);
BB.Add(anInternalWire, aFirstEdge);
TopoDS_Edge EndEdges[2];
EndEdges[0] = EndEdges[1] = aFirstEdge;
TopoDS_Vertex VV[2];
TopExp::Vertices(aFirstEdge, VV[0], VV[1]);
for (;;)
{
if (VV[0].IsSame(VV[1])) // closed wire
break;
Standard_Boolean found = Standard_False;
for (Standard_Integer ii = 0; ii < 2; ii++)
{
const TopTools_ListOfShape& Elist = IntVEmap.FindFromKey(VV[ii]);
TopTools_ListIteratorOfListOfShape itl(Elist);
for (; itl.More(); itl.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
if (anEdge.IsSame(EndEdges[ii]))
continue;
found = Standard_True;
InternalEdges.RemoveKey(anEdge);
BB.Add(anInternalWire, anEdge);
TopoDS_Vertex V1, V2;
TopExp::Vertices(anEdge, V1, V2);
VV[ii] = (V1.IsSame(VV[ii])) ? V2 : V1;
EndEdges[ii] = anEdge;
break;
}
}
if (!found) // end of open wire
break;
}
InternalWires.Append(anInternalWire);
}
Operating System
Linux
Compiler
GCC
Bitness
64-bit
OCCT Version
7.9
Additional Files
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status