Commit 452c82b6 authored by Jonathan Kunstwald's avatar Jonathan Kunstwald
Browse files

Add quat_tests.hh, tg::is_normalized for quats

parent 959261b4
......@@ -3,6 +3,7 @@
#include <typed-geometry/detail/operators/ops_mat.hh>
#include <typed-geometry/functions/basic/mix.hh>
#include <typed-geometry/functions/basic/scalar_math.hh>
#include <typed-geometry/functions/tests/quat_tests.hh>
#include <typed-geometry/functions/vector/normalize.hh>
#include <typed-geometry/types/dir.hh>
#include <typed-geometry/types/mat.hh>
......
#pragma once
#include <typed-geometry/types/quat.hh>
namespace tg
{
template <class ScalarT>
[[nodiscard]] constexpr bool is_normalized(quaternion<ScalarT> const& q, ScalarT eps = ScalarT(0.01))
{
ScalarT const length2 = q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
return abs(ScalarT(1) - length2) < eps;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment