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
use std::fmt::Debug;
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
pub struct Vector(pub f32, pub f32, pub f32);
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
pub struct Color(pub f32, pub f32, pub f32);
pub trait Vertex : Clone + Debug + PartialEq + PartialOrd {
fn position(&self) -> Vector;
}
#[derive(Debug, PartialEq, PartialOrd)]
pub struct Triangle<V: Vertex> {
pub vertices: [V; 3],
}
impl Vertex for Vector {
fn position(&self) -> Vector { *self }
}