Skip to content

Commit

Permalink
Support AABB computation for curves faces
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Jun 19, 2023
1 parent db40c13 commit af98e6a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions crates/fj-core/src/algorithms/bounding_volume/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit af98e6a

Please sign in to comment.