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
use shape::SupportMap;
use math::Point;
#[derive(Debug)]
pub struct Reflection<'a, G: ?Sized + 'a> {
shape: &'a G
}
impl<'a, G: ?Sized> Reflection<'a, G> {
#[inline]
pub fn new(shape: &'a G) -> Reflection<'a, G> {
Reflection { shape: shape }
}
#[inline]
pub fn shape(&self) -> &'a G {
self.shape
}
}
impl<'a, P, M, G: ?Sized> SupportMap<P, M> for Reflection<'a, G>
where P: Point,
G: SupportMap<P, M> {
#[inline]
fn support_point(&self, m: &M, dir: &P::Vector) -> P {
-self.shape().support_point(m, &-*dir)
}
}