feat: Vector2D Default Directions
This commit is contained in:
parent
661f2027ce
commit
fd3d1c2e38
|
@ -4,6 +4,12 @@ namespace Syntriax.Engine.Physics2D.Primitives;
|
||||||
|
|
||||||
public record Vector2D(float X, float Y)
|
public record Vector2D(float X, float Y)
|
||||||
{
|
{
|
||||||
|
public readonly static Vector2D Up = new(0f, 1f);
|
||||||
|
public readonly static Vector2D Down = new(0f, -1f);
|
||||||
|
public readonly static Vector2D Left = new(-1f, 0f);
|
||||||
|
public readonly static Vector2D Right = new(1f, 0f);
|
||||||
|
public readonly static Vector2D One = new(1f, 1f);
|
||||||
|
|
||||||
public static Vector2D operator +(Vector2D left, Vector2D right) => new(left.X + right.X, left.Y + right.Y);
|
public static Vector2D operator +(Vector2D left, Vector2D right) => new(left.X + right.X, left.Y + right.Y);
|
||||||
public static Vector2D operator -(Vector2D left, Vector2D right) => new(left.X - right.X, left.Y - right.Y);
|
public static Vector2D operator -(Vector2D left, Vector2D right) => new(left.X - right.X, left.Y - right.Y);
|
||||||
public static Vector2D operator *(Vector2D vector, float value) => new(vector.X * value, vector.Y * value);
|
public static Vector2D operator *(Vector2D vector, float value) => new(vector.X * value, vector.Y * value);
|
||||||
|
|
Loading…
Reference in New Issue