Documented the new print bed collision detection algorithm requirements:

Only convex print bed is supported.
Optimization of collision detection by precomputing the print bed shape type.
This commit is contained in:
Vojtech Bubnik 2021-10-23 15:29:00 +02:00
parent 36baae05f1
commit 0bc2448e22
4 changed files with 23 additions and 11 deletions

View file

@ -27,6 +27,7 @@
namespace Slic3r {
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// Using rotating callipers to check for collision of two convex polygons. Thus both printbed_shape and obj_hull_2d are convex polygons.
ModelInstanceEPrintVolumeState printbed_collision_state(const Polygon& printbed_shape, double print_volume_height, const Polygon& obj_hull_2d, double obj_min_z, double obj_max_z)
{
if (!Geometry::convex_polygons_intersect(printbed_shape, obj_hull_2d))
@ -362,6 +363,7 @@ BoundingBoxf3 Model::bounding_box() const
}
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// printbed_shape is convex polygon
unsigned int Model::update_print_volume_state(const Polygon& printbed_shape, double print_volume_height)
{
unsigned int num_printable = 0;
@ -1571,6 +1573,7 @@ double ModelObject::get_instance_max_z(size_t instance_idx) const
}
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// printbed_shape is convex polygon
unsigned int ModelObject::check_instances_print_volume_state(const Polygon& printbed_shape, double print_volume_height)
{
unsigned int num_printable = 0;

View file

@ -911,9 +911,11 @@ enum ModelInstanceEPrintVolumeState : unsigned char
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// return the state of the given object's volume (extrusion along z of obj_hull_2d from obj_min_z to obj_max_z)
// with respect to the given print volume (extrusion along z of printbed_shape from zero to print_volume_height)
// Using rotating callipers to check for collision of two convex polygons.
ModelInstanceEPrintVolumeState printbed_collision_state(const Polygon& printbed_shape, double print_volume_height, const Polygon& obj_hull_2d, double obj_min_z, double obj_max_z);
// return the state of the given box
// with respect to the given print volume (extrusion along z of printbed_shape from zero to print_volume_height)
// Commented out, using rotating callipers is quite expensive for a bounding box test.
//ModelInstanceEPrintVolumeState printbed_collision_state(const Polygon& printbed_shape, double print_volume_height, const BoundingBoxf3& box);
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
@ -1122,6 +1124,7 @@ public:
// Set the print_volume_state of PrintObject::instances,
// return total number of printable objects.
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// printbed_shape is convex polygon
unsigned int update_print_volume_state(const Polygon& printbed_shape, double print_volume_height);
#else
unsigned int update_print_volume_state(const BoundingBoxf3 &print_volume);