use crate::bounding_volume::Aabb;
use crate::math::{Isometry, Point, Real, Vector};
use crate::shape::Ball;
#[inline]
pub fn ball_aabb(center: &Point<Real>, radius: Real) -> Aabb {
Aabb::new(
*center + Vector::repeat(-radius),
*center + Vector::repeat(radius),
)
}
#[inline]
pub fn local_ball_aabb(radius: Real) -> Aabb {
let half_extents = Point::from(Vector::repeat(radius));
Aabb::new(-half_extents, half_extents)
}
impl Ball {
#[inline]
pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
ball_aabb(&Point::<Real>::from(pos.translation.vector), self.radius)
}
#[inline]
pub fn local_aabb(&self) -> Aabb {
local_ball_aabb(self.radius)
}
}