Make indent, and finish writing a comment that I started

This commit is contained in:
Eric Fischer
2016-04-27 10:51:54 -07:00
parent 5cfd7cf68f
commit 87fea8082f
+9 -3
View File
@@ -302,9 +302,6 @@ static void decode_clipped(ClipperLib::PolyNode *t, drawvec &out) {
// guaranteed that at least one point in the polygon is strictly // guaranteed that at least one point in the polygon is strictly
// inside its parent (not on one of its boundary lines). // inside its parent (not on one of its boundary lines).
// Once we have that, we can run through the outer rings that have
// an even number of parents,
std::vector<ring> rings; std::vector<ring> rings;
decode_rings(t, rings); decode_rings(t, rings);
std::sort(rings.begin(), rings.end()); std::sort(rings.begin(), rings.end());
@@ -323,6 +320,11 @@ nextring:
; ;
} }
// Then reverse the winding order of any rings that turned out
// to actually be inner when they are outer, or vice versa.
// (A ring is outer if it has no parent or if its parent is
// an inner ring.)
for (size_t ii = rings.size(); ii > 0; ii--) { for (size_t ii = rings.size(); ii > 0; ii--) {
size_t i = ii - 1; size_t i = ii - 1;
@@ -339,6 +341,10 @@ nextring:
} }
} }
// Then run through the rings again, outputting each outer ring
// followed by its direct children, and checking to make sure
// there are no child rings whose parents weren't identified.
for (size_t ii = rings.size(); ii > 0; ii--) { for (size_t ii = rings.size(); ii > 0; ii--) {
size_t i = ii - 1; size_t i = ii - 1;