From eca23c5b89ee584d1d6b66041002a7433d43bc55 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sun, 20 Oct 2024 14:47:42 +0300 Subject: [PATCH] feat: Math.Lerp --- Engine.Core/Math.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Engine.Core/Math.cs b/Engine.Core/Math.cs index 6c0c6fc..1412bc3 100644 --- a/Engine.Core/Math.cs +++ b/Engine.Core/Math.cs @@ -157,6 +157,16 @@ public static class Math /// The number raised to the power . public static float Pow(float x, float y) => MathF.Pow(x, y); + /// + /// Performs linear interpolation between two specified values. + /// + /// The type of the values, which must implement . + /// The starting value of the interpolation. + /// The ending value of the interpolation. + /// The interpolation factor, typically in the range [0, 1]. + /// A value that represents the linear interpolation between and . + public static T Lerp(T x, T y, T t) where T : IFloatingPoint => x + (y - x) * t; + /// /// Rounds a number to a specified number of fractional digits. ///