use na::{Translate, Translation, Transform, AbsoluteRotate}; use na; use bounding_volume::{self, AABB, HasBoundingVolume}; use shape::{BaseMesh, BaseMeshElement, TriMesh, Polyline}; use math::{Point, Vector}; impl HasBoundingVolume> for BaseMesh where P: Point, P::Vect: Translate

, M: AbsoluteRotate + Transform

, E: BaseMeshElement { #[inline] fn bounding_volume(&self, m: &M) -> AABB

{ let bv = self.bvt().root_bounding_volume().unwrap(); let ls_center = na::origin::

() + bv.translation(); let center = m.transform(&ls_center); let half_extents = (*bv.maxs() - *bv.mins()) * na::cast::::Scalar>(0.5); let ws_half_extents = m.absolute_rotate(&half_extents); AABB::new(center + (-ws_half_extents), center + ws_half_extents) } } impl HasBoundingVolume> for TriMesh

where P: Point, P::Vect: Translate

, M: AbsoluteRotate + Transform

{ #[inline] fn bounding_volume(&self, m: &M) -> AABB

{ bounding_volume::aabb(self.base_mesh(), m) } } impl HasBoundingVolume> for Polyline

where P: Point, P::Vect: Translate

, M: AbsoluteRotate + Transform

{ #[inline] fn bounding_volume(&self, m: &M) -> AABB

{ bounding_volume::aabb(self.base_mesh(), m) } }