fix(build): add missing ImageMap config fields and fix Polyline3 assignments in Fill.cpp

PrintConfig.hpp: add wall_filament and solid_infill_filament config fields
that ImageMap's Fill.cpp uses for texture zone filament assignment.

Fill.cpp: wrap 2D Polyline in Polyline3() constructor where ExtrusionPath::polyline
(now Polyline3 from ZAA) is assigned from locally created 2D paths.
Fix boundary-skin helper functions to accept Polyline3 instead of Polyline.
Use to_points() to convert Points3 to Points for Polygon constructor.
This commit is contained in:
thysson2701
2026-07-21 15:20:42 +02:00
parent dbbb28d365
commit 6d14497ddc
2 changed files with 24 additions and 16 deletions

View File

@@ -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<ExtrusionEntityCollection> 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<ExtrusionEntityCollection> 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<double>::max();
@@ -12892,28 +12892,34 @@ static double top_surface_image_boundary_skin_start_distance_sq(const Polyline &
double best = std::numeric_limits<double>::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<double>().squaredNorm());
best = std::min(best, (polyline.points[i].to_point() - anchor).cast<double>().squaredNorm());
return best;
}
return std::min((polyline.first_point() - anchor).cast<double>().squaredNorm(),
(polyline.last_point() - anchor).cast<double>().squaredNorm());
return std::min((polyline.first_point().to_point() - anchor).cast<double>().squaredNorm(),
(polyline.last_point().to_point() - anchor).cast<double>().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<double>::max();
int nearest_idx = 0;
for (int i = 0; i < (int)points.size(); ++i) {
double d = (points[i].to_point() - anchor).cast<double>().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<double>().squaredNorm() <
(polyline.first_point() - anchor).cast<double>().squaredNorm()) {
} else if ((polyline.last_point().to_point() - anchor).cast<double>().squaredNorm() <
(polyline.first_point().to_point() - anchor).cast<double>().squaredNorm()) {
polyline.reverse();
}
}

View File

@@ -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))