From 93266ed328add757c639c6eec749b41b2af4618c Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Mon, 25 Sep 2023 10:37:34 +0100 Subject: [PATCH] Add halfspace check to plane --- csg/src/plane.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csg/src/plane.rs b/csg/src/plane.rs index 1d44852..746567d 100644 --- a/csg/src/plane.rs +++ b/csg/src/plane.rs @@ -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 { glam::vec4(self.normal.x, self.normal.y, self.normal.z, -self.offset) }