From 0c6fd180f3a25efd11230c79403cce2cba1d6c9d Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Tue, 19 Sep 2023 19:40:44 +0100 Subject: [PATCH] Implement From for Plane --- csg/src/plane.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/csg/src/plane.rs b/csg/src/plane.rs index aba3730..787f383 100644 --- a/csg/src/plane.rs +++ b/csg/src/plane.rs @@ -28,6 +28,15 @@ impl Plane { } } +impl From 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