ENH: add grid & rectilinear_interlaced interface pattern

Github: #1018, #1221
Jira: STUDIO-2534

Change-Id: I8c766b5b934364253c0344e39f474e4ac3b81add
(cherry picked from commit e7d46fe60856ab511905b46799943bfde8a71826)
This commit is contained in:
Arthur 2023-03-20 18:36:56 +08:00 committed by Lane.Wei
parent 9309831d26
commit af0fca211b
6 changed files with 51 additions and 18 deletions

View file

@ -1636,11 +1636,13 @@ void Fill::connect_infill(Polylines &&infill_ordered, const std::vector<const Po
double arc_length;
};
std::vector<Arc> arches;
arches.reserve(graph.map_infill_end_point_to_boundary.size());
for (ContourIntersectionPoint &cp : graph.map_infill_end_point_to_boundary)
if (cp.contour_idx != boundary_idx_unconnected && cp.next_on_contour != &cp && cp.could_connect_next())
arches.push_back({ &cp, path_length_along_contour_ccw(&cp, cp.next_on_contour, graph.boundary_params[cp.contour_idx].back()) });
std::sort(arches.begin(), arches.end(), [](const auto &l, const auto &r) { return l.arc_length < r.arc_length; });
if (!params.dont_sort) {
arches.reserve(graph.map_infill_end_point_to_boundary.size());
for (ContourIntersectionPoint& cp : graph.map_infill_end_point_to_boundary)
if (cp.contour_idx != boundary_idx_unconnected && cp.next_on_contour != &cp && cp.could_connect_next())
arches.push_back({ &cp, path_length_along_contour_ccw(&cp, cp.next_on_contour, graph.boundary_params[cp.contour_idx].back()) });
std::sort(arches.begin(), arches.end(), [](const auto& l, const auto& r) { return l.arc_length < r.arc_length; });
}
//FIXME improve the Traveling Salesman problem with 2-opt and 3-opt local optimization.
for (Arc &arc : arches)