From ead19438208c87958545681eee284bd81a91d269 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Tue, 24 Sep 2024 08:11:35 +0100 Subject: [PATCH] Add math utility class --- KeepersCompound.Lightmapper/MathUtils.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 KeepersCompound.Lightmapper/MathUtils.cs diff --git a/KeepersCompound.Lightmapper/MathUtils.cs b/KeepersCompound.Lightmapper/MathUtils.cs new file mode 100644 index 0000000..853167b --- /dev/null +++ b/KeepersCompound.Lightmapper/MathUtils.cs @@ -0,0 +1,11 @@ +using System.Numerics; + +namespace KeepersCompound.Lightmapper; + +public static class MathUtils +{ + public static float DistanceFromPlane(Plane plane, Vector3 point) + { + return Math.Abs(Vector3.Dot(plane.Normal, point) + plane.D) / plane.Normal.Length(); + } +} \ No newline at end of file