ENH: unify multi-object copy with single copy

Also adapt empty cell stride with object size plus 1mm.

Change-Id: I47ac98bede196d636ebb3da549c16e393756de0a
This commit is contained in:
Arthur 2022-09-09 16:36:00 +08:00 committed by Lane.Wei
parent b71917b28c
commit 9edc90704a
3 changed files with 17 additions and 14 deletions

View file

@ -4074,15 +4074,15 @@ double GLCanvas3D::get_size_proportional_to_max_bed_size(double factor) const
}
//BBS
std::vector<Vec2f> GLCanvas3D::get_empty_cells(const Vec2f start_point)
std::vector<Vec2f> GLCanvas3D::get_empty_cells(const Vec2f start_point, const Vec2f step)
{
PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate();
BoundingBoxf3 build_volume = plate->get_build_volume();
Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y());
BoundingBoxf bbox(vmin, vmax);
std::vector<Vec2f> cells;
for (float x = bbox.min.x(); x < bbox.max.x(); x+=10)
for (float y = bbox.min.y(); y < bbox.max.y(); y += 10)
for (float x = bbox.min.x(); x < bbox.max.x(); x += step(0))
for (float y = bbox.min.y(); y < bbox.max.y(); y += step(1))
{
cells.emplace_back(x, y);
}
@ -4124,9 +4124,9 @@ std::vector<Vec2f> GLCanvas3D::get_empty_cells(const Vec2f start_point)
return cells;
}
Vec2f GLCanvas3D::get_nearest_empty_cell(const Vec2f start_point)
Vec2f GLCanvas3D::get_nearest_empty_cell(const Vec2f start_point, const Vec2f step)
{
std::vector<Vec2f> empty_cells = get_empty_cells(start_point);
std::vector<Vec2f> empty_cells = get_empty_cells(start_point, step);
if (!empty_cells.empty())
return empty_cells.front();
else {