The discrepancy seems to be introduced in reordering. No obvious bug

This commit is contained in:
Erica Fischer
2023-09-07 16:30:21 -07:00
parent d346b674e0
commit 81d1a7ec9a
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -1210,13 +1210,16 @@ drawvec reorder_lines(drawvec &geom) {
for (size_t i = 0; i < geom.size(); i++) { for (size_t i = 0; i < geom.size(); i++) {
if (geom[i].op == VT_MOVETO) { if (geom[i].op == VT_MOVETO) {
if (i != 0) { if (i != 0) {
// moveto is not at the start, so it is not simple
return geom; return geom;
} }
} else if (geom[i].op == VT_LINETO) { } else if (geom[i].op == VT_LINETO) {
if (i == 0) { if (i == 0) {
// lineto is at the start: can't happen
return geom; return geom;
} }
} else { } else {
// something other than moveto or lineto: can't happen
return geom; return geom;
} }
} }
@@ -1234,7 +1237,9 @@ drawvec reorder_lines(drawvec &geom) {
out.push_back(geom[geom.size() - 1 - i]); out.push_back(geom[geom.size() - 1 - i]);
} }
out[0].op = VT_MOVETO; out[0].op = VT_MOVETO;
out[out.size() - 1].op = VT_LINETO; if (out.size() > 1) {
out[out.size() - 1].op = VT_LINETO;
}
return out; return out;
} }
+1
View File
@@ -587,6 +587,7 @@ double simplify_partial(partial *p, drawvec &shared_nodes) {
} }
if (t == VT_LINE && additional[A_REVERSE]) { if (t == VT_LINE && additional[A_REVERSE]) {
geom = remove_noop(geom, t, 0);
geom = reorder_lines(geom); geom = reorder_lines(geom);
} }