From dafdbaf319debecc616ea31f77ec1a297873342e Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Mon, 18 Sep 2023 21:46:35 +0100 Subject: [PATCH] Add Eq implementations for Plane and basic derives for PlaneIntersection --- csg/src/plane.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/csg/src/plane.rs b/csg/src/plane.rs index dbc4635..bc9db1d 100644 --- a/csg/src/plane.rs +++ b/csg/src/plane.rs @@ -22,6 +22,18 @@ impl Plane { } } +impl PartialEq for Plane { + fn eq(&self, other: &Self) -> bool { + (self.normal.x - other.normal.x).abs() < math::EPSILON + && (self.normal.y - other.normal.y).abs() < math::EPSILON + && (self.normal.z - other.normal.z).abs() < math::EPSILON + && (self.offset - other.offset).abs() < math::EPSILON + } +} + +impl Eq for Plane {} + +#[derive(Clone, Copy, Debug)] pub struct PlaneIntersection { pub planes: [Plane; 3], }