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 math::Vector;
use na;
#[derive(PartialEq, Debug, Clone, RustcEncodable, RustcDecodable)]
pub struct Plane<V> {
normal: V
}
impl<V: Vector> Plane<V> {
#[inline]
pub fn new(normal: V) -> Plane<V> {
unsafe { Plane::new_normalized(na::normalize(&normal)) }
}
}
impl<V> Plane<V> {
#[inline]
pub unsafe fn new_normalized(normal: V) -> Plane<V> {
Plane {
normal: normal
}
}
#[inline]
pub fn normal(&self) -> &V {
&self.normal
}
}