Add Eq implementations for Plane and basic derives for PlaneIntersection

This commit is contained in:
Jarrod Doyle 2023-09-18 21:46:35 +01:00
parent c57d94230e
commit dafdbaf319
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 12 additions and 0 deletions

View File

@ -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 struct PlaneIntersection {
pub planes: [Plane; 3], pub planes: [Plane; 3],
} }