Add halfspace check to plane

This commit is contained in:
Jarrod Doyle 2023-09-25 10:37:34 +01:00
parent e1688f6841
commit 93266ed328
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,10 @@ impl Plane {
} }
} }
pub fn point_in_halfspace(&self, point: Vec3) -> bool {
self.normal.dot(point) - self.offset <= math::EPSILON
}
pub fn into_vec4(&self) -> Vec4 { pub fn into_vec4(&self) -> Vec4 {
glam::vec4(self.normal.x, self.normal.y, self.normal.z, -self.offset) glam::vec4(self.normal.x, self.normal.y, self.normal.z, -self.offset)
} }