summary refs log tree commit diff
path: root/src/Math/Functions.hpp
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2024-02-05 13:48:13 +0100
committerMel <einebeere@gmail.com>2024-02-05 13:48:13 +0100
commit091bf9e418ffdcf36e1735ed78d544f3d1b86785 (patch)
tree58b1cd88d9822b14c90da757cc26acb64bf9bad5 /src/Math/Functions.hpp
parentbcb89e0554e43d37daf74b3ef6e466b6630752cd (diff)
downloadmeowcraft-091bf9e418ffdcf36e1735ed78d544f3d1b86785.tar.zst
meowcraft-091bf9e418ffdcf36e1735ed78d544f3d1b86785.zip
More precise collision detection (and less NaNs)
Diffstat (limited to 'src/Math/Functions.hpp')
-rw-r--r--src/Math/Functions.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Math/Functions.hpp b/src/Math/Functions.hpp
index fd99c6d..0cda6bd 100644
--- a/src/Math/Functions.hpp
+++ b/src/Math/Functions.hpp
@@ -38,9 +38,16 @@ R sign(T x) {
 
 // III. Utility functions.
 
+// Compares two floating point numbers for equality, with a given epsilon.
 template <typename T>
 Bool floats_equal(T a, T b, Real epsilon = 0.0001f) {
     return std::abs(a - b) < epsilon;
 }
 
+// Compares two floating point numbers for inequality, with a given epsilon.
+template <typename T>
+Bool floats_less(T a, T b, Real epsilon = 0.0001f) {
+    return a < b - epsilon;
+}
+
 }
\ No newline at end of file