From 091bf9e418ffdcf36e1735ed78d544f3d1b86785 Mon Sep 17 00:00:00 2001 From: Mel Date: Mon, 5 Feb 2024 13:48:13 +0100 Subject: More precise collision detection (and less NaNs) --- src/Math/Vector.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Math/Vector.hpp') diff --git a/src/Math/Vector.hpp b/src/Math/Vector.hpp index 7d07d5c..3525e42 100644 --- a/src/Math/Vector.hpp +++ b/src/Math/Vector.hpp @@ -125,6 +125,15 @@ struct Vector { return mostly_equal(zero()); } + Bool is_nan() const { + for (UInt i = 0; i < S; i++) { + if (std::isnan(elements[i])) { + return true; + } + } + return false; + } + T operator[](USize index) const { return elements[index]; } -- cgit 1.4.1