Out of bed detection - Fixed false detection due to float precision

This commit is contained in:
Enrico Turri 2018-03-20 09:31:42 +01:00
parent 6c038d405b
commit 1f3f109263
2 changed files with 6 additions and 0 deletions

View file

@ -450,6 +450,8 @@ bool Model::fits_print_volume(const DynamicPrintConfig* config) const
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min.x), unscale(bed_box_2D.min.y), 0.0), Pointf3(unscale(bed_box_2D.max.x), unscale(bed_box_2D.max.y), config->opt_float("max_print_height")));
// Allow the objects to protrude below the print bed
print_volume.min.z = -1e10;
return print_volume.contains(transformed_bounding_box());
}
@ -459,6 +461,8 @@ bool Model::fits_print_volume(const FullPrintConfig &config) const
return true;
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(config.bed_shape.values));
BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min.x), unscale(bed_box_2D.min.y), 0.0), Pointf3(unscale(bed_box_2D.max.x), unscale(bed_box_2D.max.y), config.max_print_height));
// Allow the objects to protrude below the print bed
print_volume.min.z = -1e10;
return print_volume.contains(transformed_bounding_box());
}

View file

@ -627,6 +627,8 @@ void GLVolumeCollection::update_outside_state(const DynamicPrintConfig* config,
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
BoundingBoxf3 print_volume(Pointf3(unscale(bed_box_2D.min.x), unscale(bed_box_2D.min.y), 0.0), Pointf3(unscale(bed_box_2D.max.x), unscale(bed_box_2D.max.y), config->opt_float("max_print_height")));
// Allow the objects to protrude below the print bed
print_volume.min.z = -1e10;
for (GLVolume* volume : this->volumes)
{