Fix bug in self-intersection detection

This commit is contained in:
Shaunak Kishore
2015-09-11 01:12:42 -04:00
parent 0765e8738c
commit bfbeb3e91c

View File

@ -342,7 +342,6 @@ function extract_stroke(paths, endpoint_map, bridge_adjacency, log,
for (var i = 0; i < old_lines; i++) {
for (var j = old_lines; j < line_segments.length; j++) {
if (get_intersection(line_segments[i], line_segments[j])) {
log.push(['error', 'Extracted a self-intersecting stroke.']);
self_intersecting = true;
return;
}
@ -433,6 +432,9 @@ function extract_stroke(paths, endpoint_map, bridge_adjacency, log,
// Check if we have either closed the loop or hit an extracted segment.
var key = Point.key(current);
if (Point.equal(current, start)) {
if (self_intersecting) {
log.push(['error', 'Extracted a self-intersecting stroke.']);
}
for (var index in visited) {
extracted_indices[index] = true;
}