Tech ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION merged into tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS

This commit is contained in:
enricoturri1966 2021-10-01 13:13:26 +02:00
parent efb08cf55a
commit f84838028b
6 changed files with 18 additions and 32 deletions

View file

@ -1567,11 +1567,7 @@ unsigned int ModelObject::check_instances_print_volume_state(const Polygon& prin
for (const ModelVolume* vol : this->volumes)
if (vol->is_model_part()) {
const Transform3d matrix = model_instance->get_matrix() * vol->get_matrix();
#if ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
const BoundingBoxf3 bb = vol->mesh().transformed_bounding_box(matrix, 0.0);
#else
const BoundingBoxf3 bb = vol->get_convex_hull().transformed_bounding_box(matrix);
#endif // ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
const Polygon volume_hull_2d = its_convex_hull_2d_above(vol->mesh().its, matrix.cast<float>(), 0.0f);
ModelInstanceEPrintVolumeState state = printbed_collision_state(printbed_shape, print_volume_height, volume_hull_2d, bb.min.z(), bb.max.z());
if (state == ModelInstancePVS_Inside)
@ -1601,11 +1597,7 @@ unsigned int ModelObject::check_instances_print_volume_state(const BoundingBoxf3
unsigned int inside_outside = 0;
for (const ModelVolume *vol : this->volumes)
if (vol->is_model_part()) {
#if ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
BoundingBoxf3 bb = vol->mesh().transformed_bounding_box(model_instance->get_matrix() * vol->get_matrix(), 0.0);
#else
BoundingBoxf3 bb = vol->get_convex_hull().transformed_bounding_box(model_instance->get_matrix() * vol->get_matrix());
#endif // ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
if (print_volume.contains(bb))
inside_outside |= INSIDE;
else if (print_volume.intersects(bb))

View file

@ -79,9 +79,8 @@
#define ENABLE_2_4_0_ALPHA4 1
// Enable the fix for the detection of the out of bed state for sinking objects
#define ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION (1 && ENABLE_2_4_0_ALPHA4)
// Enable detection of out of bed using the bed perimeter and other improvements
#define ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS (1 && ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION)
// and detection of out of bed using the bed perimeter
#define ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS (1 && ENABLE_2_4_0_ALPHA4)
#endif // _prusaslicer_technologies_h_

View file

@ -429,7 +429,7 @@ BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d &trafo) c
return bbox;
}
#if ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d& trafo, double world_min_z) const
{
BoundingBoxf3 bbox;
@ -452,7 +452,7 @@ BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d& trafo, d
}
return bbox;
}
#endif // ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
TriangleMesh TriangleMesh::convex_hull_3d() const
{

View file

@ -113,10 +113,10 @@ public:
BoundingBoxf3 bounding_box() const;
// Returns the bbox of this TriangleMesh transformed by the given transformation
BoundingBoxf3 transformed_bounding_box(const Transform3d &trafo) const;
#if ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// Variant returning the bbox of the part of this TriangleMesh above the given world_min_z
BoundingBoxf3 transformed_bounding_box(const Transform3d& trafo, double world_min_z) const;
#endif // ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// Return the size of the mesh in coordinates.
Vec3d size() const { return m_stats.size.cast<double>(); }
/// Return the center of the related bounding box.