Skip to content
Snippets Groups Projects
Commit ee13086e authored by Julius Nehring-Wirxel's avatar Julius Nehring-Wirxel
Browse files

are_orthogonal epsilon is now relative to the input

parent aab762b3
No related branches found
No related tags found
1 merge request!79Feature/relative eps
......@@ -5,6 +5,7 @@
#include <typed-geometry/functions/basic/constants.hh>
#include <typed-geometry/functions/basic/scalar_math.hh>
#include <typed-geometry/functions/basic/minmax.hh>
#include <typed-geometry/functions/vector/cross.hh>
#include <typed-geometry/functions/vector/dot.hh>
......@@ -31,7 +32,7 @@ template <int D, class ScalarT, class = enable_if<is_floating_point<ScalarT>>>
template <int D, class ScalarT>
[[nodiscard]] constexpr bool are_orthogonal(vec<D, ScalarT> const& a, vec<D, ScalarT> const& b, ScalarT eps = 100 * D * tg::epsilon<ScalarT>)
{
return abs(dot(a, b)) < eps;
return abs(dot(a, b)) < abs(max(max_element(a), max_element(b))) * eps;
}
template <int D, class ScalarT>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment