You've already forked pico-launcher
mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-01-09 16:28:48 -08:00
20 lines
522 B
C++
20 lines
522 B
C++
#pragma once
|
|
#include "common.h"
|
|
|
|
class Interpolator
|
|
{
|
|
public:
|
|
template <typename T>
|
|
static constexpr T InterpolateLinear(T a, T b, T t)
|
|
{
|
|
return a + (b - a) * t;
|
|
}
|
|
|
|
template <typename T, u32 FractionBits>
|
|
static constexpr fixed<T, FractionBits> InterpolateCubic(
|
|
fixed<T, FractionBits> cf0, fixed<T, FractionBits> cf1,
|
|
fixed<T, FractionBits> cf2, fixed<T, FractionBits> cf3, fixed<T, FractionBits> t)
|
|
{
|
|
return ((((cf0 * t + cf1) * t) + cf2) * t) + cf3;
|
|
}
|
|
}; |