use crate::math::{Point, Real, Vector};
#[inline]
pub fn point_cloud_support_point_id(dir: &Vector<Real>, points: &[Point<Real>]) -> usize {
let mut best_pt = 0;
let mut best_dot = points[0].coords.dot(dir);
for (i, p) in points.iter().enumerate().skip(1) {
let dot = p.coords.dot(dir);
if dot > best_dot {
best_dot = dot;
best_pt = i;
}
}
best_pt
}
#[inline]
pub fn point_cloud_support_point(dir: &Vector<Real>, points: &[Point<Real>]) -> Point<Real> {
points[point_cloud_support_point_id(dir, points)]
}