mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-11-02 21:41:28 +08:00
Fix bug in self-intersection detection
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user