Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand Aabb API #1870

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/fj-math/src/aabb.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use parry2d_f64::bounding_volume::BoundingVolume as _;
use parry3d_f64::bounding_volume::BoundingVolume as _;

use super::{Point, Vector};
Expand Down Expand Up @@ -67,6 +68,19 @@ impl Aabb<2> {
max: aabb.maxs.into(),
}
}

/// Convert the AABB to a Parry AABB
pub fn to_parry(self) -> parry2d_f64::bounding_volume::Aabb {
parry2d_f64::bounding_volume::Aabb {
mins: self.min.to_na(),
maxs: self.max.to_na(),
}
}

/// Merge this AABB with another
pub fn merged(&self, other: &Self) -> Self {
self.to_parry().merged(&other.to_parry()).into()
}
}

impl Aabb<3> {
Expand Down