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
use {
super::{vec3_is_finite, Vec3},
serde::{Deserialize, Serialize},
};
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub struct Plane {
distance: f32,
normal: Vec3,
}
impl Plane {
pub fn new(normal: Vec3, distance: f32) -> Self {
debug_assert!(distance.is_finite());
debug_assert!(vec3_is_finite(normal));
debug_assert!(normal.is_normalized());
Self { distance, normal }
}
pub const fn distance(&self) -> f32 {
self.distance
}
pub const fn normal(&self) -> Vec3 {
self.normal
}
}