parry2d/bounding_volume/
bounding_sphere_cuboid.rs1use crate::bounding_volume::BoundingSphere;
2use crate::math::{Pose, Vector};
3use crate::shape::Cuboid;
4
5impl Cuboid {
6 #[inline]
8 pub fn bounding_sphere(&self, pos: &Pose) -> BoundingSphere {
9 let bv: BoundingSphere = self.local_bounding_sphere();
10 bv.transform_by(pos)
11 }
12
13 #[inline]
15 pub fn local_bounding_sphere(&self) -> BoundingSphere {
16 let radius = self.half_extents.length();
17 BoundingSphere::new(Vector::ZERO, radius)
18 }
19}