From f06ad263b7d75747f7172f6a2393c48f1211177d Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Tue, 9 Aug 2022 17:14:38 -0700 Subject: [PATCH] add Fixed.Vector2.Lerp --- src/Math/Fixed/Vector2.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Math/Fixed/Vector2.cs b/src/Math/Fixed/Vector2.cs index be63811c..b05a733d 100644 --- a/src/Math/Fixed/Vector2.cs +++ b/src/Math/Fixed/Vector2.cs @@ -226,6 +226,21 @@ namespace MoonWorks.Math.Fixed return new Vector2((int) X, (int) Y); } + /// + /// Creates a new that contains linear interpolation of the specified vectors. + /// + /// The first vector. + /// The second vector. + /// Weighting value(between 0.0 and 1.0). + /// The result of linear interpolation of the specified vectors. + public static Vector2 Lerp(Vector2 value1, Vector2 value2, Fix64 amount) + { + return new Vector2( + Fix64.Lerp(value1.X, value2.X, amount), + Fix64.Lerp(value1.Y, value2.Y, amount) + ); + } + /// /// Returns a representation of this in the format: /// {X:[] Y:[]}