ENH:expand projectable area for volumes_bounding_box

jira: none

Change-Id: Idac6fdccd67e43dfe65341a500c93d47c5595e77
This commit is contained in:
zhou.xu 2024-10-11 17:06:24 +08:00 committed by Lane.Wei
parent 1a73f72d6b
commit ba19513380
1 changed files with 7 additions and 2 deletions

View File

@ -1576,11 +1576,16 @@ BoundingBoxf3 GLCanvas3D::assembly_view_cur_bounding_box() const {
BoundingBoxf3 GLCanvas3D::volumes_bounding_box() const
{
BoundingBoxf3 bb;
auto partplate_list_box = wxGetApp().plater()->get_partplate_list().get_bounding_box();
BoundingBoxf3 expand_part_plate_list_box;
auto plate_list_box = wxGetApp().plater()->get_partplate_list().get_bounding_box();
auto horizontal_radius = 0.5 * sqrt(std::pow(plate_list_box.min[0] - plate_list_box.max[0], 2) + std::pow(plate_list_box.min[1] - plate_list_box.max[1], 2));
const float scale = 2;
expand_part_plate_list_box.merge(plate_list_box.min - scale * Vec3d(horizontal_radius, horizontal_radius, 0));
expand_part_plate_list_box.merge(plate_list_box.max + scale * Vec3d(horizontal_radius, horizontal_radius, 0));
for (const GLVolume *volume : m_volumes.volumes) {
if (!m_apply_zoom_to_volumes_filter || ((volume != nullptr) && volume->zoom_to_volumes)) {
const auto v_bb = volume->transformed_bounding_box();
if (!partplate_list_box.overlap(v_bb))
if (!expand_part_plate_list_box.overlap(v_bb))
continue;
bb.merge(v_bb);
}