fix(build): add Polyline3::is_closed(), correct Point3/Point usage per polyline type in Fill.cpp
This commit is contained in:
@@ -9803,20 +9803,20 @@ static bool top_surface_image_append_recolored_perimeter_path(ExtrusionEntitiesP
|
||||
};
|
||||
|
||||
for (size_t point_idx = 1; point_idx < path.polyline.points.size(); ++point_idx) {
|
||||
const Point &p0 = path.polyline.points[point_idx - 1];
|
||||
const Point &p1 = path.polyline.points[point_idx];
|
||||
const double len_mm = unscale<double>(p0.distance_to(p1));
|
||||
const Point3 &p0 = path.polyline.points[point_idx - 1];
|
||||
const Point3 &p1 = path.polyline.points[point_idx];
|
||||
const double len_mm = unscale<double>(p0.to_point().distance_to(p1.to_point()));
|
||||
if (!std::isfinite(len_mm) || len_mm <= EPSILON)
|
||||
continue;
|
||||
const int steps = std::max(1, int(std::floor(len_mm / min_run_mm)));
|
||||
for (int step = 0; step < steps; ++step) {
|
||||
const double t0 = double(step) / double(steps);
|
||||
const double t1 = double(step + 1) / double(steps);
|
||||
const Point q0 = lerp(p0, p1, t0);
|
||||
const Point q1 = lerp(p0, p1, t1);
|
||||
const Point q0 = lerp(p0, p1, t0).to_point();
|
||||
const Point q1 = lerp(p0, p1, t1).to_point();
|
||||
if (q0 == q1)
|
||||
continue;
|
||||
const Point qm = lerp(p0, p1, 0.5 * (t0 + t1));
|
||||
const Point qm = lerp(p0, p1, 0.5 * (t0 + t1)).to_point();
|
||||
int extruder_override = top_surface_image_perimeter_override_at_point(qm, masks);
|
||||
if (extruder_override >= 0 && len_mm / double(steps) < min_run_mm - EPSILON)
|
||||
extruder_override = -1;
|
||||
@@ -10864,20 +10864,20 @@ static ExtrusionPaths top_surface_image_split_path(const ExtrusionPath &path,
|
||||
for (size_t point_idx = 1; point_idx < path.polyline.points.size(); ++point_idx) {
|
||||
if ((point_idx & 63) == 1)
|
||||
check_canceled(throw_if_canceled);
|
||||
const Point p0 = path.polyline.points[point_idx - 1];
|
||||
const Point p1 = path.polyline.points[point_idx];
|
||||
const double len_mm = unscale<double>(p0.distance_to(p1));
|
||||
const Point3 p0 = path.polyline.points[point_idx - 1];
|
||||
const Point3 p1 = path.polyline.points[point_idx];
|
||||
const double len_mm = unscale<double>(p0.to_point().distance_to(p1.to_point()));
|
||||
if (!std::isfinite(len_mm) || len_mm <= EPSILON)
|
||||
continue;
|
||||
const int steps = std::max(1, int(std::ceil(len_mm / sample_step_mm)));
|
||||
for (int step = 0; step < steps; ++step) {
|
||||
const double t0 = double(step) / double(steps);
|
||||
const double t1 = double(step + 1) / double(steps);
|
||||
const Point q0 = lerp(p0, p1, t0);
|
||||
const Point q1 = lerp(p0, p1, t1);
|
||||
const Point q0 = lerp(p0, p1, t0).to_point();
|
||||
const Point q1 = lerp(p0, p1, t1).to_point();
|
||||
if (q0 == q1)
|
||||
continue;
|
||||
const Point qm = lerp(p0, p1, 0.5 * (t0 + t1));
|
||||
const Point qm = lerp(p0, p1, 0.5 * (t0 + t1)).to_point();
|
||||
const std::vector<float> weights =
|
||||
texture_mapping_offset_component_weights_at_point(context,
|
||||
unscale<float>(qm.x()),
|
||||
|
||||
@@ -302,6 +302,8 @@ public:
|
||||
|
||||
virtual Lines3 lines() const;
|
||||
|
||||
bool is_closed() const { return this->points.size() >= 2 && this->points.front() == this->points.back(); }
|
||||
|
||||
// Convert to 2D Polyline by dropping Z coordinates
|
||||
Polyline to_polyline() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user