From af98e6a6f4a05c80a6a8dca1183d1179bdd9742c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Jun 2023 11:14:47 +0200 Subject: [PATCH] Support AABB computation for curves faces --- .../src/algorithms/bounding_volume/face.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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),