Costrain number of edges in sorted_edges

This commit is contained in:
Thomas Krijnen
2021-03-22 14:03:24 +01:00
parent 7c61c7d200
commit eb09cc8af8
+4 -1
View File
@@ -1338,6 +1338,7 @@ namespace {
void sort_edges(const TopoDS_Wire& wire, std::vector<TopoDS_Edge>& sorted_edges) {
TopTools_IndexedDataMapOfShapeListOfShape map;
TopExp::MapShapesAndAncestors(wire, TopAbs_VERTEX, TopAbs_EDGE, map);
auto num_edges = IfcGeom::Kernel::count(wire, TopAbs_EDGE);
TopoDS_Vertex v0, v1;
// @todo this creates the ancestor map twice
@@ -1347,7 +1348,9 @@ namespace {
// @todo this probably still does not work on a closed wire consisting of one (circular) edge.
while (!v0.IsSame(v1) || ignore_first_equality_because_closed) {
while (sorted_edges.size() < num_edges &&
(!v0.IsSame(v1) || ignore_first_equality_because_closed))
{
ignore_first_equality_because_closed = false;
if (!map.Contains(v0)) {
throw std::runtime_error("Disconnected vertex");