mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13: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
|
* 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)));
|
return (b * (Dot(a, b) / Dot(b, b)));
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ namespace GlitchyEngine.Math
|
|||||||
/**
|
/**
|
||||||
* Calculates the rejection of a from b
|
* 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)));
|
return (a - b * (Dot(a, b) / Dot(b, b)));
|
||||||
}
|
}
|
||||||
@@ -159,6 +159,16 @@ namespace GlitchyEngine.Math
|
|||||||
return a + interpolationValue * (b - a);
|
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
|
// Assignment operators
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -194,6 +194,16 @@ namespace GlitchyEngine.Math
|
|||||||
return a + interpolationValue * (b - a);
|
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
|
// Assignment operators
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -179,6 +179,16 @@ namespace GlitchyEngine.Math
|
|||||||
return a + interpolationValue * (b - a);
|
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
|
// Assignment operators
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user