diff --git a/src/libslic3r/Geometry.hpp b/src/libslic3r/Geometry.hpp index 11d405e4c2..7c670bb7c6 100644 --- a/src/libslic3r/Geometry.hpp +++ b/src/libslic3r/Geometry.hpp @@ -86,7 +86,7 @@ static inline bool is_ccw(const Polygon &poly) #if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS // returns true if the given polygons are identical -static bool are_approx(const Polygon& lhs, const Polygon& rhs) +static inline bool are_approx(const Polygon& lhs, const Polygon& rhs) { if (lhs.points.size() != rhs.points.size()) return false; diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp index 4546444eed..73661723a0 100644 --- a/src/libslic3r/Model.cpp +++ b/src/libslic3r/Model.cpp @@ -1566,12 +1566,14 @@ unsigned int ModelObject::check_instances_print_volume_state(const Polygon& prin unsigned int inside_outside = 0; 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(model_instance->get_matrix() * vol->get_matrix(), 0.0); + const BoundingBoxf3 bb = vol->mesh().transformed_bounding_box(matrix, 0.0); #else - const BoundingBoxf3 bb = vol->get_convex_hull().transformed_bounding_box(model_instance->get_matrix() * vol->get_matrix()); + const BoundingBoxf3 bb = vol->get_convex_hull().transformed_bounding_box(matrix); #endif // ENABLE_FIX_SINKING_OBJECT_OUT_OF_BED_DETECTION - ModelInstanceEPrintVolumeState state = printbed_collision_state(printbed_shape, print_volume_height, bb); + const Polygon volume_hull_2d = its_convex_hull_2d_above(vol->mesh().its, matrix.cast(), 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) inside_outside |= INSIDE; else if (state == ModelInstancePVS_Fully_Outside) diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index c096dfcf6d..365493a66b 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -71,8 +71,15 @@ // Enable fixing loading of gcode files generated with SuperSlicer in GCodeViewer #define ENABLE_FIX_SUPERSLICER_GCODE_IMPORT (1 && ENABLE_2_4_0_ALPHA3) + + +//==================== +// 2.4.0.alpha4 techs +//==================== +#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_ALPHA3) +#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)