mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Vector Lerp
This commit is contained in:
@@ -145,7 +145,19 @@ namespace GlitchyEngine.Math
|
||||
{
|
||||
return (a - b * (Dot(a, b) / Dot(b, b)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Interpolates linearly between two given vectors.
|
||||
* @param a The first vector.
|
||||
* @param b The second vector.
|
||||
* @param interpolationValue The value that linearly interpolates between a and b.
|
||||
* (0 means a will be returned, 1 means b will be returned.)
|
||||
* @returns The resulting linear interpolation.
|
||||
*/
|
||||
public static Vector2 Lerp(Vector2 a, Vector2 b, float interpolationValue)
|
||||
{
|
||||
return a + interpolationValue * (b - a);
|
||||
}
|
||||
|
||||
//
|
||||
// Assignment operators
|
||||
|
||||
@@ -180,6 +180,19 @@ namespace GlitchyEngine.Math
|
||||
{
|
||||
return .(Math.Floor(value.X), Math.Floor(value.Y), Math.Floor(value.Z));
|
||||
}
|
||||
|
||||
/**
|
||||
* Interpolates linearly between two given vectors.
|
||||
* @param a The first vector.
|
||||
* @param b The second vector.
|
||||
* @param interpolationValue The value that linearly interpolates between a and b.
|
||||
* (0 means a will be returned, 1 means b will be returned.)
|
||||
* @returns The resulting linear interpolation.
|
||||
*/
|
||||
public static Vector3 Lerp(Vector3 a, Vector3 b, float interpolationValue)
|
||||
{
|
||||
return a + interpolationValue * (b - a);
|
||||
}
|
||||
|
||||
//
|
||||
// Assignment operators
|
||||
|
||||
@@ -166,6 +166,19 @@ namespace GlitchyEngine.Math
|
||||
return (a - b * (Dot(a, b) / Dot(b, b)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Interpolates linearly between two given vectors.
|
||||
* @param a The first vector.
|
||||
* @param b The second vector.
|
||||
* @param interpolationValue The value that linearly interpolates between a and b.
|
||||
* (0 means a will be returned, 1 means b will be returned.)
|
||||
* @returns The resulting linear interpolation.
|
||||
*/
|
||||
public static Vector4 Lerp(Vector4 a, Vector4 b, float interpolationValue)
|
||||
{
|
||||
return a + interpolationValue * (b - a);
|
||||
}
|
||||
|
||||
//
|
||||
// Assignment operators
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user