Eliminate infinite loop AssemblePolygon
parent
7366a6c53d
commit
88a0e55f35
|
@ -269,31 +269,25 @@ 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;
|
||||
for(i = 0; i < l.n; i++) {
|
||||
if(!l[i].tag) {
|
||||
first = l[i].a;
|
||||
last = l[i].b;
|
||||
/// @todo fix const!
|
||||
const_cast<SEdge*>(&(l[i]))->tag = 1;
|
||||
break;
|
||||
Vector first = Vector::From(0, 0, 0);
|
||||
Vector last = Vector::From(0, 0, 0);
|
||||
int i;
|
||||
for(i = 0; i < l.n; i++) {
|
||||
if(!l[i].tag) {
|
||||
first = l[i].a;
|
||||
last = l[i].b;
|
||||
/// @todo fix const!
|
||||
const_cast<SEdge*>(&(l[i]))->tag = 1;
|
||||
// Create a new empty contour in our polygon, and finish assembling
|
||||
// into that contour.
|
||||
dest->AddEmptyContour();
|
||||
if(!AssembleContour(first, last, dest->l.Last(), errorAt, keepDir)) {
|
||||
allClosed = false;
|
||||
}
|
||||
// But continue assembling, even if some of the contours are open
|
||||
}
|
||||
if(i >= l.n) {
|
||||
return allClosed;
|
||||
}
|
||||
|
||||
// Create a new empty contour in our polygon, and finish assembling
|
||||
// into that contour.
|
||||
dest->AddEmptyContour();
|
||||
if(!AssembleContour(first, last, dest->l.Last(), errorAt, keepDir)) {
|
||||
allClosed = false;
|
||||
}
|
||||
// But continue assembling, even if some of the contours are open
|
||||
}
|
||||
return allClosed;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue