Implement From<Vec4> for Plane

This commit is contained in:
Jarrod Doyle 2023-09-19 19:40:44 +01:00
parent edb70037d6
commit 0c6fd180f3
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 9 additions and 0 deletions

View File

@ -28,6 +28,15 @@ impl Plane {
}
}
impl From<Vec4> for Plane {
fn from(value: Vec4) -> Self {
Self {
normal: Vec3::new(value.x, value.y, value.z),
offset: -value.w,
}
}
}
impl PartialEq for Plane {
fn eq(&self, other: &Self) -> bool {
(self.normal.x - other.normal.x).abs() < math::EPSILON