diff --git a/crates/fj-core/src/algorithms/bounding_volume/edge.rs b/crates/fj-core/src/algorithms/bounding_volume/edge.rs index ba6d56a09..d8f914d53 100644 --- a/crates/fj-core/src/algorithms/bounding_volume/edge.rs +++ b/crates/fj-core/src/algorithms/bounding_volume/edge.rs @@ -1,15 +1,21 @@ -use fj_math::Aabb; +use fj_math::{Aabb, Vector}; use crate::{geometry::curve::Curve, objects::HalfEdge}; impl super::BoundingVolume<2> for HalfEdge { fn aabb(&self) -> Option> { match self.curve() { - Curve::Circle(_) => { - // I don't currently have an example model to test this with. - // This should change soon, and then this will panic and can be - // addressed. - todo!("Computing AABB of arc is not supported yet") + Curve::Circle(circle) => { + // Just calculate the AABB of the whole circle. This is not the + // most precise, but it should do for now. + + let center_to_min_max = + Vector::from([circle.radius(), circle.radius()]); + + Some(Aabb { + min: circle.center() - center_to_min_max, + max: circle.center() + center_to_min_max, + }) } Curve::Line(_) => { let points = self.boundary().map(|point_curve| { diff --git a/crates/fj-core/src/algorithms/bounding_volume/face.rs b/crates/fj-core/src/algorithms/bounding_volume/face.rs index 86cba6a08..3a1df7a0c 100644 --- a/crates/fj-core/src/algorithms/bounding_volume/face.rs +++ b/crates/fj-core/src/algorithms/bounding_volume/face.rs @@ -8,11 +8,17 @@ impl super::BoundingVolume<3> for Face { let surface = self.surface().geometry(); match surface.u { - GlobalPath::Circle(_) => { - // I don't currently have an example model to test this - // with. This should change soon, and then this will panic - // and can be addressed. - todo!("Computing AABB of curved face is not supported yet") + GlobalPath::Circle(circle) => { + // This is not the most precise way to calculate the AABB, + // doing it for the whole circle, but it should do. + + let aabb_bottom = circle.aabb(); + let aabb_top = Aabb { + min: aabb_bottom.min + surface.v, + max: aabb_bottom.max + surface.v, + }; + + aabb_bottom.merged(&aabb_top) } GlobalPath::Line(_) => Aabb { min: surface.point_from_surface_coords(aabb2.min),