parry3d/bounding_volume/
bounding_sphere_ball.rs

1use crate::bounding_volume::BoundingSphere;
2use crate::math::{Isometry, Point, Real};
3use crate::shape::Ball;
4
5impl Ball {
6    /// Computes the world-space bounding sphere of this ball, transformed by `pos`.
7    #[inline]
8    pub fn bounding_sphere(&self, pos: &Isometry<Real>) -> BoundingSphere {
9        let bv: BoundingSphere = self.local_bounding_sphere();
10        bv.transform_by(pos)
11    }
12
13    /// Computes the local-space Aabb of this ball.
14    #[inline]
15    pub fn local_bounding_sphere(&self) -> BoundingSphere {
16        BoundingSphere::new(Point::origin(), self.radius)
17    }
18}