From b43dff99a2b521d2addff8beab9f91c44d97d354 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Tue, 7 Feb 2023 21:46:14 +0100 Subject: [PATCH] Fixed a floating point rounding error preventing faces from being found for some world-space points. Fixes lighting bugs in a few areas. --- bsp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/bsp.h b/bsp.h index 8a2aa6e..7c6a8f2 100644 --- a/bsp.h +++ b/bsp.h @@ -371,6 +371,7 @@ typedef struct World } double dot = p0.dotProduct(p1) / (m0 * m1); + if (dot < -1) dot = -1; if (dot > 1) dot = 1; // Floating point rounding errors, YAY! angleSum += acos(dot); }