From afa57ab9ff086379a9570ddcb4bbb8caac42db71 Mon Sep 17 00:00:00 2001 From: Julius Nehring-Wirxel Date: Mon, 30 Mar 2020 19:52:05 +0200 Subject: [PATCH] Fixed are_orthogonal for real. --- src/typed-geometry/functions/tests/vec_tests.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/typed-geometry/functions/tests/vec_tests.hh b/src/typed-geometry/functions/tests/vec_tests.hh index 7b39982..bf6cacd 100644 --- a/src/typed-geometry/functions/tests/vec_tests.hh +++ b/src/typed-geometry/functions/tests/vec_tests.hh @@ -32,7 +32,9 @@ template >> template [[nodiscard]] constexpr bool are_orthogonal(vec const& a, vec const& b, ScalarT eps = 100 * D * tg::epsilon) { - return abs(dot(a, b)) < max(max_element(abs(a)), max_element(abs(b))) * eps; + // the error scales with the square of the magnitude of the inputs + auto const scale = max(max_element(abs(a)), max_element(abs(b))); + return abs(dot(a, b)) < scale * scale * eps; } template -- GitLab