fj-core 0.49.0

Early-stage b-rep CAD kernel.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use fj_math::Aabb;

use crate::{geometry::Geometry, objects::Cycle};

impl super::BoundingVolume<2> for Cycle {
    fn aabb(&self, geometry: &Geometry) -> Option<Aabb<2>> {
        let mut aabb: Option<Aabb<2>> = None;

        for edge in self.half_edges() {
            let new_aabb =
                edge.aabb(geometry).expect("`Edge` can always compute AABB");
            aabb = Some(aabb.map_or(new_aabb, |aabb| aabb.merged(&new_aabb)));
        }

        aabb
    }
}