mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Added Min/Max to Vectors
This commit is contained in:
@@ -133,7 +133,7 @@ namespace GlitchyEngine.Math
|
||||
/**
|
||||
* Calculates the projection of a onto b
|
||||
*/
|
||||
public Vector2 Project(Vector2 a, Vector2 b)
|
||||
public static Vector2 Project(Vector2 a, Vector2 b)
|
||||
{
|
||||
return (b * (Dot(a, b) / Dot(b, b)));
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace GlitchyEngine.Math
|
||||
/**
|
||||
* Calculates the rejection of a from b
|
||||
*/
|
||||
public Vector2 Reject(Vector2 a, Vector2 b)
|
||||
public static Vector2 Reject(Vector2 a, Vector2 b)
|
||||
{
|
||||
return (a - b * (Dot(a, b) / Dot(b, b)));
|
||||
}
|
||||
@@ -159,6 +159,16 @@ namespace GlitchyEngine.Math
|
||||
return a + interpolationValue * (b - a);
|
||||
}
|
||||
|
||||
public static Vector2 Min(Vector2 a, Vector2 b)
|
||||
{
|
||||
return .(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y));
|
||||
}
|
||||
|
||||
public static Vector2 Max(Vector2 a, Vector2 b)
|
||||
{
|
||||
return .(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y));
|
||||
}
|
||||
|
||||
//
|
||||
// Assignment operators
|
||||
//
|
||||
|
||||
@@ -193,6 +193,16 @@ namespace GlitchyEngine.Math
|
||||
{
|
||||
return a + interpolationValue * (b - a);
|
||||
}
|
||||
|
||||
public static Vector3 Min(Vector3 a, Vector3 b)
|
||||
{
|
||||
return .(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y), Math.Min(a.Z, b.Z));
|
||||
}
|
||||
|
||||
public static Vector3 Max(Vector3 a, Vector3 b)
|
||||
{
|
||||
return .(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y), Math.Min(a.Z, b.Z));
|
||||
}
|
||||
|
||||
//
|
||||
// Assignment operators
|
||||
|
||||
@@ -178,6 +178,16 @@ namespace GlitchyEngine.Math
|
||||
{
|
||||
return a + interpolationValue * (b - a);
|
||||
}
|
||||
|
||||
public static Vector4 Min(Vector4 a, Vector4 b)
|
||||
{
|
||||
return .(Math.Min(a.X, b.X), Math.Min(a.Y, b.Y), Math.Min(a.Z, b.Z), Math.Min(a.W, b.W));
|
||||
}
|
||||
|
||||
public static Vector4 Max(Vector4 a, Vector4 b)
|
||||
{
|
||||
return .(Math.Max(a.X, b.X), Math.Max(a.Y, b.Y), Math.Min(a.Z, b.Z), Math.Min(a.W, b.W));
|
||||
}
|
||||
|
||||
//
|
||||
// Assignment operators
|
||||
|
||||
Reference in New Issue
Block a user