From d6616be202a08dea1d08e6c8ca301ba556451422 Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Fri, 16 Apr 2021 21:42:15 +0200 Subject: [PATCH] FIX> infinite loop because intersection is out of line place on line mast be perpendicular to source line but NOT to edge --- src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp b/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp index 367ec17ab9..c493b07ebc 100644 --- a/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp +++ b/src/libslic3r/SLA/SupportIslands/VoronoiGraphUtils.cpp @@ -967,11 +967,9 @@ std::pair VoronoiGraphUtils::point_on_lines( bool is_linear = edge->is_linear(); Point edge_point = create_edge_point(position); - Point dir = to_point(edge->vertex0()) - to_point(edge->vertex1()); - Line intersecting_line(edge_point, edge_point + PointUtils::perp(dir)); auto point_on_line = [&](const VD::edge_type *edge) -> Point { - assert(edge->is_finite()); + assert(edge->is_finite()); const VD::cell_type *cell = edge->cell(); size_t line_index = cell->source_index(); const Line &line = lines[line_index]; @@ -984,6 +982,9 @@ std::pair VoronoiGraphUtils::point_on_lines( if (cell->source_category() == SOURCE_CATEGORY_SEGMENT_END_POINT) { return line.b; } + + Point dir = LineUtils::direction(line); + Line intersecting_line(edge_point, edge_point + PointUtils::perp(dir)); std::optional intersection = LineUtils::intersection(line, intersecting_line); assert(intersection.has_value()); return intersection->cast();