use na::{Translate, Rotate}; use na; use geometry::Proximity; use entities::support_map::SupportMap; use entities::shape::Plane; use math::{Point, Vector}; /// Proximity between a plane and a support-mapped shape (Cuboid, ConvexHull, etc.) pub fn plane_against_support_map(mplane: &M, plane: &Plane, mother: &M, other: &G, margin: ::Scalar) -> Proximity where P: Point, M: Translate

+ Rotate, G: SupportMap { let plane_normal = mplane.rotate(plane.normal()); let plane_center = mplane.translate(&na::origin()); let deepest = other.support_point(mother, &-plane_normal); let distance = na::dot(&plane_normal, &(plane_center - deepest)); if distance >= -margin { if distance >= na::zero() { Proximity::Intersecting } else { Proximity::WithinMargin } } else { Proximity::Disjoint } } /// Proximity between a support-mapped shape (Cuboid, ConvexHull, etc.) and a plane. pub fn support_map_against_plane(mother: &M, other: &G, mplane: &M, plane: &Plane, margin: ::Scalar) -> Proximity where P: Point, M: Translate

+ Rotate, G: SupportMap { plane_against_support_map(mplane, plane, mother, other, margin) }