use na::{Transform, Rotate}; use na; use shape::Cuboid; use support_map::SupportMap; use math::Point; impl
SupportMap
for Cuboid {
#[inline]
fn support_point(&self, m: &M, dir: &P::Vect) -> P {
let local_dir = m.inverse_rotate(dir);
let mut pres: P = na::origin();
let he = self.half_extents();
for i in 0usize .. na::dimension:: () {
if local_dir[i] < na::zero() {
pres[i] = -he[i];
}
else {
pres[i] = he[i];
}
}
m.transform(&pres)
}
}