mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 06:45:56 +08:00
Fix SPE-2068: Helical layer changes out of bed bounds.
This commit is contained in:
parent
f31d7f1d8c
commit
01502f6a14
@ -2673,7 +2673,11 @@ Polygon Bed::get_inner_offset(const std::vector<Vec2d>& shape, const double padd
|
||||
transform(begin(shape), end(shape), back_inserter(shape_scaled), [](const Vec2d& point){
|
||||
return scaled(point);
|
||||
});
|
||||
return shrink({Polygon{shape_scaled}}, scaled(padding)).front();
|
||||
Polygons inner_offset{shrink({Polygon{shape_scaled}}, scaled(padding))};
|
||||
if (inner_offset.empty()) {
|
||||
return Polygon{};
|
||||
}
|
||||
return inner_offset.front();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2692,21 +2696,18 @@ std::optional<std::string> GCodeGenerator::get_helical_layer_change_gcode(
|
||||
|
||||
const Point n_gon_start_point{this->last_pos()};
|
||||
|
||||
static GCode::Impl::Bed bed{
|
||||
GCode::Impl::Bed bed{
|
||||
this->m_config.bed_shape.values,
|
||||
circle_radius
|
||||
circle_radius * 2
|
||||
};
|
||||
if (!bed.contains_within_padding(this->point_to_gcode(n_gon_start_point))) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const Point n_gon_centeroid{
|
||||
n_gon_start_point
|
||||
+ scaled(Vec2d{
|
||||
(bed.centroid - unscaled(n_gon_start_point)).normalized()
|
||||
* circle_radius
|
||||
})
|
||||
};
|
||||
const Vec2crd n_gon_vector{scaled(Vec2d{
|
||||
(bed.centroid - this->point_to_gcode(n_gon_start_point)).normalized() * circle_radius
|
||||
})};
|
||||
const Point n_gon_centeroid{n_gon_start_point + n_gon_vector};
|
||||
|
||||
const Polygon n_gon{GCode::Impl::generate_regular_polygon(
|
||||
n_gon_centeroid,
|
||||
|
Loading…
x
Reference in New Issue
Block a user