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
use std::marker::PhantomData;
use cgmath::{Point2, Point3};
use cgmath::{Vector2, Vector3};
#[derive(Copy, Clone, PartialEq, Debug)]
#[cfg_attr(feature = "eders", derive(Serialize, Deserialize))]
pub struct Obb<S, V, P> {
pub center: P,
pub axis: V,
pub extents: V,
marker: PhantomData<S>,
}
impl<S, V, P> Obb<S, V, P> {
pub fn new(center: P, axis: V, extents: V) -> Self {
Self {
center,
axis,
extents,
marker: PhantomData,
}
}
}
pub type Obb2<S> = Obb<S, Vector2<S>, Point2<S>>;
pub type Obb3<S> = Obb<S, Vector3<S>, Point3<S>>;