use bounding_volume::{self, BoundingSphere, AABB}; use query::{PointQuery, RayCast}; use shape::{Ball, CompositeShape, Compound, Cone, ConvexHull, Cuboid, Cylinder, Plane, Polyline, Segment, Shape, SupportMap, TriMesh, Triangle}; use math::{Isometry, Point}; macro_rules! impl_as_support_map( () => { #[inline] fn as_support_map(&self) -> Option<&SupportMap
> { Some(self) } #[inline] fn is_support_map(&self) -> bool { true } } ); macro_rules! impl_as_composite_shape( () => { #[inline] fn as_composite_shape(&self) -> Option<&CompositeShape
> { Some(self) } #[inline] fn is_composite_shape(&self) -> bool { true } } ); macro_rules! impl_shape_common( () => { #[inline] fn aabb(&self, m: &M) -> AABB
{ bounding_volume::aabb(self, m) } #[inline] fn bounding_sphere(&self, m: &M) -> BoundingSphere
{ bounding_volume::bounding_sphere(self, m) } #[inline] fn as_ray_cast(&self) -> Option<&RayCast
> { Some(self) } #[inline] fn as_point_query(&self) -> Option<&PointQuery
> {
Some(self)
}
}
);
impl for Triangle {
impl_shape_common!();
impl_as_support_map!();
}
impl for Segment {
impl_shape_common!();
impl_as_support_map!();
}
impl for Ball for Cuboid for Cylinder for Cone for ConvexHull {
impl_shape_common!();
impl_as_support_map!();
}
impl for Compound {
impl_shape_common!();
impl_as_composite_shape!();
}
impl for TriMesh {
impl_shape_common!();
impl_as_composite_shape!();
}
impl for Polyline {
impl_shape_common!();
impl_as_composite_shape!();
}
impl for Plane