Commit 72d19987 authored by Philip Trettner's avatar Philip Trettner
Browse files

Merge branch 'kw/develop' into 'develop'

is_normalized overload for quaternions, minor fixes

See merge request !107
parents 41d86538 ab66aca6
......@@ -11,7 +11,7 @@
macro(arcana_source_group)
foreach(loop_var ${ARGN})
if (${CMAKE_GENERATOR} MATCHES "Visual Studio")
if (${CMAKE_GENERATOR} MATCHES "Visual Studio" OR WIN32)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" FILES ${${loop_var}})
else()
source_group("${CMAKE_CURRENT_SOURCE_DIR}/src" FILES ${${loop_var}})
......
......@@ -2,6 +2,7 @@
#include <typed-geometry/types/comp.hh>
#include <typed-geometry/types/objects/box.hh>
#include <typed-geometry/types/objects/line.hh>
#include <typed-geometry/types/objects/ray.hh>
#include <typed-geometry/types/objects/segment.hh>
......
......@@ -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>
......
......@@ -286,13 +286,13 @@ template <class T>
[[nodiscard]] constexpr f32 smoothstep(f32 edge0, f32 edge1, f32 x)
{
auto t = clamp((x - edge0) / (edge1 - edge0), f32(0), f32(1));
return t * t * (f32(3) - f32(2) * t);
auto t = clamp((x - edge0) / (edge1 - edge0), 0.f, 1.f);
return t * t * (3.f - 2.f * t);
}
[[nodiscard]] constexpr f64 smoothstep(f64 edge0, f64 edge1, f64 x)
{
auto t = clamp((x - edge0) / (edge1 - edge0), f64(0), f64(1));
return t * t * (f64(3) - f64(2) * t);
auto t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
return t * t * (3.0 - 2.0 * t);
}
// ==================================================================
......
#pragma once
#include <typed-geometry/types/quat.hh>
#include <typed-geometry/functions/basic/scalar_math.hh>
namespace tg
{
template <class ScalarT>
[[nodiscard]] constexpr bool is_normalized(quaternion<ScalarT> const& q, ScalarT eps = ScalarT(0.001))
{
ScalarT const length2 = q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
return tg::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