Skip to content

Commit

Permalink
optimize bound calc slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
robtfm committed Oct 28, 2024
1 parent 6650c04 commit 74290ca
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/scene_runner/src/bounds_calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ pub fn scene_regions(parcels: impl Iterator<Item = IVec2>) -> Vec<Region> {

// gather horizontal
loop {
let next_col = (0..=extent.y)
.map(|y| rect_base + IVec2::new(extent.x + 1, y))
.collect::<Vec<_>>();
if next_col.iter().all(|p| region.contains(p)) {
for p in next_col {
let next_col = || (0..=extent.y).map(|y| rect_base + IVec2::new(extent.x + 1, y));
if next_col().all(|p| region.contains(&p)) {
for p in next_col() {
region.remove(&p);
}
extent.x += 1;
Expand Down

0 comments on commit 74290ca

Please sign in to comment.