fj_core/algorithms/bounding_volume/shell.rs
1use fj_math::Aabb;
2
3use crate::{geometry::Geometry, objects::Shell};
4
5impl super::BoundingVolume<3> for Shell {
6 fn aabb(&self, geometry: &Geometry) -> Option<Aabb<3>> {
7 let mut aabb: Option<Aabb<3>> = None;
8
9 for face in self.faces() {
10 let new_aabb = face.aabb(geometry);
11 aabb = aabb.map_or(new_aabb, |aabb| match new_aabb {
12 Some(new_aabb) => Some(aabb.merged(&new_aabb)),
13 None => Some(aabb),
14 });
15 }
16
17 aabb
18 }
19}