Math » lerp() module

Linear interpolations al a C++20's std::lerp.

Functions

auto lerp(half start, half finish, half alpha) -> half constexpr noexcept
Returns a linear interpolation between two half-precision floats.
auto lerp(float start, float finish, float alpha) -> float constexpr noexcept
Returns a linear interpolation between two floats.
auto lerp(double start, double finish, double alpha) -> double constexpr noexcept
Returns a linear interpolation between two doubles.
auto lerp(long double start, long double finish, long double alpha) -> long double constexpr noexcept
Returns a linear interpolation between two long doubles.
auto lerp(float128_t start, float128_t finish, float128_t alpha) -> float128_t constexpr noexcept
Returns a linear interpolation between two float128_ts.
auto lerp(_Float16 start, _Float16 finish, _Float16 alpha) -> _Float16 constexpr noexcept
Returns a linear interpolation between two _Float16s.
template <typename T, typename U, typename V>
auto lerp(T start, U finish, V alpha) -> auto constexpr noexcept
Returns a linear interpolation between two arithmetic values.
template <typename S, size_t D>
auto lerp(const vector<S, D>& start, const vector<S, D>& finish, delta_scalar_type alpha) -> vector<S, D> constexpr noexcept
Performs a linear interpolation between two vectors.

Function documentation

half lerp(half start, half finish, half alpha) constexpr noexcept
#include <muu/half.h>

Returns a linear interpolation between two half-precision floats.

float lerp(float start, float finish, float alpha) constexpr noexcept
#include <muu/math.h>

Returns a linear interpolation between two floats.

double lerp(double start, double finish, double alpha) constexpr noexcept
#include <muu/math.h>

Returns a linear interpolation between two doubles.

long double lerp(long double start, long double finish, long double alpha) constexpr noexcept
#include <muu/math.h>

Returns a linear interpolation between two long doubles.

float128_t lerp(float128_t start, float128_t finish, float128_t alpha) constexpr noexcept
#include <muu/math.h>

Returns a linear interpolation between two float128_ts.

_Float16 lerp(_Float16 start, _Float16 finish, _Float16 alpha) constexpr noexcept
#include <muu/math.h>

Returns a linear interpolation between two _Float16s.

#include <muu/math.h>
template <typename T, typename U, typename V>
auto lerp(T start, U finish, V alpha) constexpr noexcept

Returns a linear interpolation between two arithmetic values.

Integer arguments are promoted to double.

template <typename S, size_t D>
vector<S, D> lerp(const vector<S, D>& start, const vector<S, D>& finish, delta_scalar_type alpha) constexpr noexcept

Performs a linear interpolation between two vectors.