use utils; use shape::SupportMap; use math::{Isometry, Point}; #[derive(PartialEq, Debug, Clone)] /// The implicit convex hull of a set of points. pub struct ConvexHull
{ points: Vec
, } impl
ConvexHull
{ /// Creates a polytope from a set of point. /// /// The set of point as not assumed to form a convex polytope. #[inline] pub fn new(points: Vec
) -> ConvexHull
{ ConvexHull { points: points } } } impl
ConvexHull
{
/// The list of points of this convex polytope.
#[inline]
pub fn points(&self) -> &[P] {
&self.points[..]
}
}
impl for ConvexHull {
#[inline]
fn support_point(&self, m: &M, dir: &P::Vector) -> P {
let local_dir = m.inverse_rotate_vector(dir);
let best_pt = utils::point_cloud_support_point(&local_dir, self.points());
m.transform_point(&best_pt)
}
}