diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 66e35c70bf3..b582be3b002 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -9769,7 +9769,7 @@ static void top_surface_image_append_perimeter_path_piece(ExtrusionEntitiesPtr & remove_same_neighbor(polyline); if (polyline.points.size() < 2 || polyline.length() <= SCALED_EPSILON) return; - ExtrusionPath *path = new ExtrusionPath(std::move(polyline), source); + ExtrusionPath *path = new ExtrusionPath(Polyline3(std::move(polyline)), source); if (extruder_override < 0) { out.emplace_back(path); return; @@ -10371,7 +10371,7 @@ static void top_surface_image_append_rectilinear_repair_lines(ExtrusionEntityCol params.flow.mm3_per_mm(), params.flow.width(), params.flow.height()); - path.polyline = std::move(polyline); + path.polyline = Polyline3(std::move(polyline)); path.intersect_expolygons(clip, &collection); } } @@ -10894,7 +10894,7 @@ static ExtrusionPaths top_surface_image_split_path(const ExtrusionPath &path, Polyline polyline; polyline.points.emplace_back(q0); polyline.points.emplace_back(q1); - ExtrusionPath segment(std::move(polyline), path); + ExtrusionPath segment(Polyline3(std::move(polyline)), path); segment.width = width; segment.height = height; segment.mm3_per_mm = Flow(width, height, nozzle_diameter).mm3_per_mm(); @@ -11081,7 +11081,7 @@ static void top_surface_image_same_layer_partition_fill(ExtrusionEntityCollectio Flow(lane_width, params.flow.height(), params.flow.nozzle_diameter()).mm3_per_mm(), lane_width, params.flow.height()); - path.polyline = std::move(polyline); + path.polyline = Polyline3(std::move(polyline)); path.intersect_expolygons(clip, &collection); } } @@ -11140,7 +11140,7 @@ static void top_surface_image_append_boundary_skin_path_coverage(const Extrusion const float scaled_epsilon) { if (path.is_closed() && path.polyline.points.size() >= 4) { - Polygon polygon(path.polyline.points); + Polygon polygon(to_points(path.polyline.points)); if (polygon.points.size() > 1 && polygon.points.front() == polygon.points.back()) polygon.points.pop_back(); remove_same_neighbor(polygon); @@ -11358,7 +11358,7 @@ static std::unique_ptr top_surface_image_spiral_colle params.flow.mm3_per_mm(), params.flow.width(), params.flow.height()); - path->polyline = std::move(polyline); + path->polyline = Polyline3(std::move(polyline)); collection->entities.emplace_back(path); } if (leftover != nullptr) @@ -11482,7 +11482,7 @@ static std::unique_ptr top_surface_image_boundary_ski output_flow.mm3_per_mm(), output_flow.width(), output_flow.height()); - path->polyline = std::move(polyline); + path->polyline = Polyline3(std::move(polyline)); collection->entities.emplace_back(path); } top_surface_image_reorder_boundary_skin_entities(*collection); @@ -12884,7 +12884,7 @@ static ExtrusionPath *top_surface_image_last_extrusion_path(ExtrusionEntitiesPtr return nullptr; } -static double top_surface_image_boundary_skin_start_distance_sq(const Polyline &polyline, const Point &anchor) +static double top_surface_image_boundary_skin_start_distance_sq(const Polyline3 &polyline, const Point &anchor) { if (!polyline.is_valid()) return std::numeric_limits::max(); @@ -12892,28 +12892,34 @@ static double top_surface_image_boundary_skin_start_distance_sq(const Polyline & double best = std::numeric_limits::max(); const size_t point_count = polyline.points.size() > 1 ? polyline.points.size() - 1 : polyline.points.size(); for (size_t i = 0; i < point_count; ++i) - best = std::min(best, (polyline.points[i] - anchor).cast().squaredNorm()); + best = std::min(best, (polyline.points[i].to_point() - anchor).cast().squaredNorm()); return best; } - return std::min((polyline.first_point() - anchor).cast().squaredNorm(), - (polyline.last_point() - anchor).cast().squaredNorm()); + return std::min((polyline.first_point().to_point() - anchor).cast().squaredNorm(), + (polyline.last_point().to_point() - anchor).cast().squaredNorm()); } -static void top_surface_image_boundary_skin_orient_near(Polyline &polyline, const Point &anchor) +static void top_surface_image_boundary_skin_orient_near(Polyline3 &polyline, const Point &anchor) { if (!polyline.is_valid()) return; if (polyline.is_closed()) { - Points points = polyline.points; + Points3 points = polyline.points; points.pop_back(); if (points.empty()) return; - const int nearest_idx = anchor.nearest_point_index(points); + // find nearest 2D point index + double best = std::numeric_limits::max(); + int nearest_idx = 0; + for (int i = 0; i < (int)points.size(); ++i) { + double d = (points[i].to_point() - anchor).cast().squaredNorm(); + if (d < best) { best = d; nearest_idx = i; } + } std::rotate(points.begin(), points.begin() + nearest_idx, points.end()); points.emplace_back(points.front()); polyline.points = std::move(points); - } else if ((polyline.last_point() - anchor).cast().squaredNorm() < - (polyline.first_point() - anchor).cast().squaredNorm()) { + } else if ((polyline.last_point().to_point() - anchor).cast().squaredNorm() < + (polyline.first_point().to_point() - anchor).cast().squaredNorm()) { polyline.reverse(); } } diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index c8bdab29360..9859e8f3b41 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1158,6 +1158,7 @@ PRINT_CONFIG_CLASS_DEFINE( // Detect bridging perimeters ((ConfigOptionBool, detect_overhang_wall)) ((ConfigOptionInt, outer_wall_filament_id)) + ((ConfigOptionInt, wall_filament)) ((ConfigOptionInt, inner_wall_filament_id)) ((ConfigOptionFloatOrPercent, inner_wall_line_width)) ((ConfigOptionFloat, inner_wall_speed)) @@ -1167,6 +1168,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, minimum_sparse_infill_area)) ((ConfigOptionInt, internal_solid_filament_id)) ((ConfigOptionInt, top_surface_filament_id)) + ((ConfigOptionInt, solid_infill_filament)) ((ConfigOptionInt, bottom_surface_filament_id)) ((ConfigOptionFloatOrPercent, internal_solid_infill_line_width)) ((ConfigOptionFloat, internal_solid_infill_speed))