ncollide3d/bounding_volume/
bounding_sphere_ball.rs1use crate::bounding_volume::{BoundingSphere, HasBoundingVolume};
2use crate::math::{Isometry, Point};
3use crate::shape::Ball;
4use na::RealField;
5
6impl<N: RealField + Copy> HasBoundingVolume<N, BoundingSphere<N>> for Ball<N> {
7 #[inline]
8 fn bounding_volume(&self, m: &Isometry<N>) -> BoundingSphere<N> {
9 let bv: BoundingSphere<N> = self.local_bounding_volume();
10 bv.transform_by(m)
11 }
12
13 #[inline]
14 fn local_bounding_volume(&self) -> BoundingSphere<N> {
15 BoundingSphere::new(Point::origin(), self.radius)
16 }
17}