3using System.Runtime.CompilerServices;
10 [MethodImpl(MethodImplOptions.AggressiveInlining)]
15 [MethodImpl(MethodImplOptions.AggressiveInlining)]
16 public static double Clamp01(
double value)
20 return value > 1 ? 1 : value;
24 [MethodImpl(MethodImplOptions.AggressiveInlining)]
25 public static double InverseLerp(
double a,
double b,
double value) =>
26 a != b ?
Clamp01((value - a) / (b - a)) : 0;
static double InverseLerp(double a, double b, double value)
Calculates the linear parameter t that produces the interpolant value within the range [a,...
static double Clamp01(double value)
Clamps value between 0 and 1 and returns value.
static double LerpUnclamped(double a, double b, double t)
Linearly interpolates between a and b by t with no limit to t.