From ba1951338045b04537159052a64e167bdac411ae Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Fri, 11 Oct 2024 17:06:24 +0800 Subject: [PATCH] ENH:expand projectable area for volumes_bounding_box jira: none Change-Id: Idac6fdccd67e43dfe65341a500c93d47c5595e77 --- src/slic3r/GUI/GLCanvas3D.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 6ff232faa..ddf2bb928 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -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); }