@@ -180,11 +180,11 @@ BranchingScheme::BranchingScheme(
180180
181181 shape = shape::clean_extreme_slopes_inner (shape).front ();
182182
183- auto mm = shape.compute_min_max ();
184- bb_bin_type.x_min = mm. first . x ;
185- bb_bin_type.x_max = mm. second . x ;
186- bb_bin_type.y_min = mm. first . y ;
187- bb_bin_type.y_max = mm. second . y ;
183+ AxisAlignedBoundingBox aabb = shape.compute_min_max ();
184+ bb_bin_type.x_min = aabb. x_min ;
185+ bb_bin_type.x_max = aabb. x_max ;
186+ bb_bin_type.y_min = aabb. y_min ;
187+ bb_bin_type.y_max = aabb. y_max ;
188188
189189 LengthDbl y_min = bb_bin_type.y_min
190190 - (bb_bin_type.y_max - bb_bin_type.y_min )
@@ -565,16 +565,10 @@ BranchingScheme::BranchingScheme(
565565 }
566566 }
567567
568- for (Support& support: direction_data.supporting_parts ) {
569- auto mm = support.shape .compute_min_max ();
570- support.min = mm.first ;
571- support.max = mm.second ;
572- }
573- for (Support& support: direction_data.supported_parts ) {
574- auto mm = support.shape .compute_min_max ();
575- support.min = mm.first ;
576- support.max = mm.second ;
577- }
568+ for (Support& support: direction_data.supporting_parts )
569+ support.aabb = support.shape .compute_min_max ();
570+ for (Support& support: direction_data.supported_parts )
571+ support.aabb = support.shape .compute_min_max ();
578572 }
579573
580574 // for (TrapezoidSetId trapezoid_set_id = 0;
@@ -585,10 +579,10 @@ BranchingScheme::BranchingScheme(
585579 // std::cout << "item_type_id " << trapezoid_set.item_type_id
586580 // << " angle " << trapezoid_set.angle
587581 // << " mirror " << trapezoid_set.mirror
588- // << " x_min " << item_type.compute_min_max(trapezoid_set.angle).first.x
589- // << " x_max " << item_type.compute_min_max(trapezoid_set.angle).second.x
590- // << " y_min " << item_type.compute_min_max(trapezoid_set.angle).first.y
591- // << " y_max " << item_type.compute_min_max(trapezoid_set.angle).second.y
582+ // << " x_min " << item_type.compute_min_max(trapezoid_set.angle).x_min
583+ // << " x_max " << item_type.compute_min_max(trapezoid_set.angle).x_max
584+ // << " y_min " << item_type.compute_min_max(trapezoid_set.angle).y_min
585+ // << " y_max " << item_type.compute_min_max(trapezoid_set.angle).y_max
592586 // << std::endl;
593587 // std::cout << "trapezoid_set_id " << trapezoid_set_id << std::endl;
594588 // std::cout << "item_type_id " << trapezoid_set.item_type_id
@@ -1179,15 +1173,15 @@ BranchingScheme::Node BranchingScheme::child_tmp(
11791173 // Compute node.xe_max and node.ye_max.
11801174 Point xy = convert_point_back ({node.x , node.y }, node.last_bin_direction );
11811175 xy = (1.0 / instance ().parameters ().scale_value ) * xy;
1182- auto mm = item_type.compute_min_max (
1176+ AxisAlignedBoundingBox aabb = item_type.compute_min_max (
11831177 trapezoid_set.angle ,
11841178 trapezoid_set.mirror );
11851179 if (insertion.new_bin_direction == Direction::Any) { // Same bin
1186- node.xe_max = std::max (parent.xe_max , xy.x + mm. second . x );
1187- node.ye_max = std::max (parent.ye_max , xy.y + mm. second . y );
1180+ node.xe_max = std::max (parent.xe_max , xy.x + aabb. x_max );
1181+ node.ye_max = std::max (parent.ye_max , xy.y + aabb. y_max );
11881182 } else {
1189- node.xe_max = xy.x + mm. second . x ;
1190- node.ye_max = xy.y + mm. second . y ;
1183+ node.xe_max = xy.x + aabb. x_max ;
1184+ node.ye_max = xy.y + aabb. y_max ;
11911185 }
11921186
11931187 node.leftover_value = (bin_type.x_max - bin_type.x_min ) * (bin_type.y_max - bin_type.y_min )
@@ -1602,11 +1596,11 @@ void BranchingScheme::update_insertion(
16021596 Insertion insertion = insertion_orig;
16031597 insertion.new_bin_direction = Direction::Any;
16041598
1605- LengthDbl ys_tmp = supporting_part.min . y + insertion.supporting_part_y
1606- - (supported_part.max . y - trapezoid_set.y_min )
1599+ LengthDbl ys_tmp = supporting_part.aabb . y_min + insertion.supporting_part_y
1600+ - (supported_part.aabb . y_max - trapezoid_set.y_min )
16071601 - instance_.parameters ().scale_value * instance ().parameters ().item_item_minimum_spacing ;
1608- LengthDbl ye_tmp = supporting_part.max . y + insertion.supporting_part_y
1609- + (trapezoid_set.y_max - supported_part.min . y )
1602+ LengthDbl ye_tmp = supporting_part.aabb . y_max + insertion.supporting_part_y
1603+ + (trapezoid_set.y_max - supported_part.aabb . y_min )
16101604 + instance_.parameters ().scale_value * instance ().parameters ().item_item_minimum_spacing ;
16111605 if (strictly_greater (ys_tmp, parent->ye )
16121606 || strictly_lesser (ye_tmp, parent->ys )) {
@@ -1923,10 +1917,10 @@ void BranchingScheme::insertion_trapezoid_set(
19231917 return ;
19241918 }
19251919
1926- insertion.ys = supporting_part.min . y + supporting_part_y
1920+ insertion.ys = supporting_part.aabb . y_min + supporting_part_y
19271921 - (trapezoid_set.y_max - trapezoid_set.y_min )
19281922 - instance_.parameters ().scale_value * instance ().parameters ().item_item_minimum_spacing ;
1929- insertion.ye = supporting_part.max . y + supporting_part_y
1923+ insertion.ye = supporting_part.aabb . y_max + supporting_part_y
19301924 + (trapezoid_set.y_max - trapezoid_set.y_min )
19311925 + instance_.parameters ().scale_value * instance ().parameters ().item_item_minimum_spacing ;
19321926 parent->children_insertions .push_back (insertion);
0 commit comments