fj_core/algorithms/bounding_volume/
cycle.rs

1use fj_math::Aabb;
2
3use crate::{geometry::Geometry, objects::Cycle};
4
5impl super::BoundingVolume<2> for Cycle {
6    fn aabb(&self, geometry: &Geometry) -> Option<Aabb<2>> {
7        let mut aabb: Option<Aabb<2>> = None;
8
9        for edge in self.half_edges() {
10            let new_aabb =
11                edge.aabb(geometry).expect("`Edge` can always compute AABB");
12            aabb = Some(aabb.map_or(new_aabb, |aabb| aabb.merged(&new_aabb)));
13        }
14
15        aabb
16    }
17}