Attempt to speed up outside bed detection (#8869)

* Don't check intersection if points below bed is also inside the bed, when the bed is convex

* Skip intersection check if bbox not overlapping

* Remove duplicated out of bed check

* Faster (but less accurate) bbox test

* Merge branch 'main' into dev/faster-outside-check

# Conflicts:
#	src/libslic3r/Model.cpp
This commit is contained in:
Noisyfox
2025-04-14 23:23:08 +08:00
committed by GitHub
parent d930911834
commit 083429ff91
4 changed files with 24 additions and 12 deletions

View File

@@ -3317,7 +3317,14 @@ ModelInstanceEPrintVolumeState ModelInstance::calc_print_volume_state(const Buil
}
const Transform3d matrix = this->get_matrix() * vol->get_matrix();
BuildVolume::ObjectState state = build_volume.object_state(vol->mesh().its, matrix.cast<float>(), true /* may be below print bed */);
const auto bboxt = bb.transformed(matrix);
const BoundingBoxf bbox2d{to_2d(bboxt.min), to_2d(bboxt.max)};
BuildVolume::ObjectState state;
if (!build_volume.bounding_volume2d().inflated(BuildVolume::SceneEpsilon).overlap(bbox2d))
state = BuildVolume::ObjectState::Outside;
else
state = build_volume.object_state(vol->mesh().its, matrix.cast<float>(), true /* may be below print bed */);
if (state == BuildVolume::ObjectState::Inside)
// Volume is completely inside.
inside_outside |= INSIDE;