ENH:The first object should locate at plate center

Jira: STUDIO-6023
Change-Id: If4284136fe63ca576463445f3ab16b6e18ead30f
This commit is contained in:
zhou.xu 2024-01-22 11:06:20 +08:00 committed by Lane.Wei
parent 1baf3a1e52
commit 3225124a7c
1 changed files with 4 additions and 2 deletions

View File

@ -4960,8 +4960,10 @@ std::vector<Vec2f> GLCanvas3D::get_empty_cells(const Vec2f start_point, const Ve
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()+step(0)/2; x < bbox.max.x()-step(0)/2; x += step(0))
for (float y = bbox.min.y()+step(1)/2; y < bbox.max.y()-step(1)/2; y += step(1))
auto min_x = start_point.x() - step(0) * int((start_point.x() - bbox.min.x()) / step(0));
auto min_y = start_point.y() - step(1) * int((start_point.y() - bbox.min.y()) / step(1));
for (float x = min_x; x < bbox.max.x() - step(0) / 2; x += step(0))
for (float y = min_y; y < bbox.max.y() - step(1) / 2; y += step(1))
{
cells.emplace_back(x, y);
}