parry3d/bounding_volume/
bounding_sphere_capsule.rs

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