Skip to content

Commit

Permalink
Added map_bounds method to Aabx
Browse files Browse the repository at this point in the history
  • Loading branch information
zesterer committed Apr 18, 2020
1 parent 123104b commit b8fc912
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/geom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ macro_rules! geom_impl_aabr_or_aabb {
let max = $Vec { $($p: f($p),)+ };
$Aab { min, max }
}

/// Returns this bounding shape, with each bound converted using the given closure.
pub fn map_bounds<D,F>(self, mut f: F) -> $Aab<D> where F: FnMut($Vec<T>) -> $Vec<D>
{
let Self { min, max } = self;
$Aab { min: f(min), max: f(max) }
}
}
};
}
Expand Down

0 comments on commit b8fc912

Please sign in to comment.