ENH: fix some assert in debug mode

Signed-off-by: salt.wei <salt.wei@bambulab.com>
Change-Id: I2d5796269d512672a3c3be7d6ebdc41f6cc58da8
This commit is contained in:
salt.wei 2023-07-05 20:41:14 +08:00 committed by Lane.Wei
parent fcda0e5f2c
commit 6fde6747c4

View file

@ -4256,6 +4256,7 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp
auto is_through_overhang = [this](const Polyline& travel) {
BoundingBox travel_bbox = get_extents(travel);
travel_bbox.inflated(1);
travel_bbox.defined = true;
const float protect_z_scaled = scale_(0.4);
std::pair<float, float> z_range;
@ -4271,6 +4272,9 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp
for (size_t idx : idx_of_object_sorted) {
for (const Point & instance_shift : objects_instances_shift[idx]) {
BoundingBox instance_bbox = boundingBox_for_objects[idx];
if (!instance_bbox.defined) //BBS: Don't need to check when bounding box of overhang area is empty(undefined)
continue;
instance_bbox.offset(scale_(EPSILON));
instance_bbox.translate(instance_shift.x(), instance_shift.y());
if (!instance_bbox.overlap(travel_bbox))