parry3d/bounding_volume/
bounding_sphere_segment.rs

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