ncollide3d/bounding_volume/
aabb_plane.rs

1use crate::bounding_volume::{HasBoundingVolume, AABB};
2use crate::math::{Isometry, Point, Vector};
3use crate::shape::Plane;
4use na::{self, RealField};
5
6impl<N: RealField + Copy> HasBoundingVolume<N, AABB<N>> for Plane<N> {
7    #[inline]
8    fn bounding_volume(&self, _: &Isometry<N>) -> AABB<N> {
9        self.local_bounding_volume()
10    }
11
12    #[inline]
13    fn local_bounding_volume(&self) -> AABB<N> {
14        // We divide by 2.0  so that we can still make some operations with it (like loosening)
15        // without breaking the box.
16        let max = Point::from(Vector::repeat(
17            N::max_value().unwrap() * na::convert(0.5f64),
18        ));
19
20        AABB::new(-max, max)
21    }
22}