Eliminate infinite loop AssemblePolygon

This commit is contained in:
phkahler 2020-05-06 17:24:10 -04:00
parent 7366a6c53d
commit 88a0e55f35

View File

@ -269,7 +269,6 @@ bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir) co
dest->Clear();
bool allClosed = true;
for(;;) {
Vector first = Vector::From(0, 0, 0);
Vector last = Vector::From(0, 0, 0);
int i;
@ -279,13 +278,6 @@ bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir) co
last = l[i].b;
/// @todo fix const!
const_cast<SEdge*>(&(l[i]))->tag = 1;
break;
}
}
if(i >= l.n) {
return allClosed;
}
// Create a new empty contour in our polygon, and finish assembling
// into that contour.
dest->AddEmptyContour();
@ -294,6 +286,8 @@ bool SEdgeList::AssemblePolygon(SPolygon *dest, SEdge *errorAt, bool keepDir) co
}
// But continue assembling, even if some of the contours are open
}
}
return allClosed;
}
//-----------------------------------------------------------------------------