Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Rinzii/ccmath into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinzii committed Apr 9, 2024
2 parents c98233b + 4aa31f3 commit 8753859
Show file tree
Hide file tree
Showing 12 changed files with 574 additions and 3 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
Checks: '-*,
-modernize-use-trailing-return-type,
bugprone-*,
-bugprone-easily-swappable-parameters,
Expand Down
1 change: 1 addition & 0 deletions benchmark/ccmath_benchmark_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static void BM_ccm_abs(benchmark::State& state) {
}
BENCHMARK(BM_ccm_abs)->Arg(16)->Arg(256)->Arg(4096)->Arg(65536)->Complexity();
/*
static void BM_std_log_rand_double(bm::State& state) {
auto randomDoubles = generateRandomDoubles(static_cast<size_t>(state.range(0)), DefaultSeed);
Expand Down
1 change: 1 addition & 0 deletions ccmath_extensions_headers.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
)


set(ccmath_extensions_headers
Expand Down
31 changes: 31 additions & 0 deletions include/ccmath/extensions/slerp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2024-Present Ian Pike
* Copyright (c) 2024-Present ccmath contributors
*
* This library is provided under the MIT License.
* See LICENSE for more information.
*/

#pragma once

#include "ccmath/math/exponential/exp2.hpp"

namespace ccm::ext
{
/**
* @brief Frame rate independent linear interpolation smoothing.
* @tparam T Type of the input and output.
* @param a Current value.
* @param b Target value.
* @param t Delta time, in seconds.
* @param h Half-life, time until halfway, in seconds.
* @return The smoothed value.
*
* @warning Currently waiting on ccm::exp2 to be implemented. Till then this will NOT work.
*/
template<typename T>
inline constexpr T slerp(T a, T b, T t, T h)
{
return b + (a - b) * ccm::exp2<T>(-t / h);
}
} // namespace ccm::ext
Loading

0 comments on commit 8753859

Please sign in to comment.