1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use crate::math::{Isometry, Point, Real, Vector};
use na::Unit;
pub trait SupportMap {
fn local_support_point(&self, dir: &Vector<Real>) -> Point<Real>;
fn local_support_point_toward(&self, dir: &Unit<Vector<Real>>) -> Point<Real> {
self.local_support_point(dir.as_ref())
}
fn support_point(&self, transform: &Isometry<Real>, dir: &Vector<Real>) -> Point<Real> {
let local_dir = transform.inverse_transform_vector(dir);
transform * self.local_support_point(&local_dir)
}
fn support_point_toward(
&self,
transform: &Isometry<Real>,
dir: &Unit<Vector<Real>>,
) -> Point<Real> {
let local_dir = Unit::new_unchecked(transform.inverse_transform_vector(dir));
transform * self.local_support_point_toward(&local_dir)
}
}