Don't add overlapping points to close paths in the stroking algorithm.

These extra points are unnecessary and can confuse the partitioner,
because they sometimes prevent it from detecting winding numbers
properly. This is a bug in the partitioner and should be fixed, but we
shouldn't be generating these points to begin with.

Partially addresses #57.
This commit is contained in:
Patrick Walton 2017-12-21 13:20:13 -08:00
parent 98250b9232
commit f132117d4c
1 changed files with 0 additions and 8 deletions

View File

@ -42,9 +42,6 @@ impl Stroke {
// Close the first subpath if necessary. // Close the first subpath if necessary.
if closed && !output.endpoints.is_empty() { if closed && !output.endpoints.is_empty() {
let first_endpoint = output.endpoints[first_endpoint_index as usize];
output.endpoints.push(first_endpoint);
let last_endpoint_index = output.endpoints.len() as u32; let last_endpoint_index = output.endpoints.len() as u32;
output.subpaths.push(Subpath { output.subpaths.push(Subpath {
first_endpoint_index: first_endpoint_index, first_endpoint_index: first_endpoint_index,
@ -60,11 +57,6 @@ impl Stroke {
self.offset_subpath(output, &input, subpath_index); self.offset_subpath(output, &input, subpath_index);
// Close the path. // Close the path.
if !output.endpoints.is_empty() {
let first_endpoint = output.endpoints[first_endpoint_index as usize];
output.endpoints.push(first_endpoint);
}
let last_endpoint_index = output.endpoints.len() as u32; let last_endpoint_index = output.endpoints.len() as u32;
output.subpaths.push(Subpath { output.subpaths.push(Subpath {
first_endpoint_index: first_endpoint_index, first_endpoint_index: first_endpoint_index,