arrange polies: try connect to closest point when extension and projection both do not work

This commit is contained in:
Thomas Krijnen
2026-05-03 21:46:11 +02:00
parent 7c6f6a4176
commit 53c2ddbb47
+18
View File
@@ -2187,6 +2187,23 @@ extend_end_vertices_based_on_input_simple(
} }
} }
if (closest_point) {
constructed_segments.push_front({M, *closest_point});
} else {
for (auto& poly : outer_perimiter) {
for (auto it = poly.begin(); it != poly.end(); ++it) {
auto Pp = *it;
auto d = CGAL::squared_distance(Pp, M);
if (d < (max_projection_distance * max_projection_distance)) {
if (d < closest_distance) {
closest_distance = d;
closest_point = Pp;
}
}
}
}
if (closest_point) { if (closest_point) {
constructed_segments.push_front({M, *closest_point}); constructed_segments.push_front({M, *closest_point});
} else { } else {
@@ -2197,6 +2214,7 @@ extend_end_vertices_based_on_input_simple(
} }
} }
} }
}
return constructed_segments; return constructed_segments;
} }