//! Support mapping based Cuboid shape. use na::Iterable; use na; use math::Vector; /// Shape of a box. #[derive(PartialEq, Debug, Clone, RustcEncodable, RustcDecodable)] pub struct Cuboid { half_extents: V, } impl Cuboid { /// Creates a new box from its half-extents. Half-extents are the box half-width along each /// axis. Each half-extent must be greater than 0.04. #[inline] pub fn new(half_extents: V) -> Cuboid { assert!(half_extents.iter().all(|e| *e >= na::zero())); Cuboid { half_extents: half_extents } } } impl Cuboid { /// The half-extents of this box. Half-extents are the box half-width along each axis. #[inline] pub fn half_extents(&self) -> &V { &self.half_extents } }