feat: Vector2D.Abs
This commit is contained in:
parent
326bcfca61
commit
08b31d9db1
|
@ -13,6 +13,7 @@ public static class Vector2DExtensions
|
|||
public static Vector2D Multiply(this Vector2D vector, float value) => Vector2D.Multiply(vector, value);
|
||||
public static Vector2D Subdivide(this Vector2D vector, float value) => Vector2D.Subdivide(vector, value);
|
||||
|
||||
public static Vector2D Abs(Vector2D vector) => Vector2D.Abs(vector);
|
||||
public static Vector2D Reflect(this Vector2D vector, Vector2D normal) => Vector2D.Reflect(vector, normal);
|
||||
public static Vector2D Normalize(this Vector2D vector) => Vector2D.Normalize(vector);
|
||||
public static Vector2D FromTo(this Vector2D from, Vector2D to) => Vector2D.FromTo(from, to);
|
||||
|
|
|
@ -34,6 +34,7 @@ public record Vector2D(float X, float Y)
|
|||
public static Vector2D Multiply(Vector2D vector, float value) => vector * value;
|
||||
public static Vector2D Subdivide(Vector2D vector, float value) => vector / value;
|
||||
|
||||
public static Vector2D Abs(Vector2D vector) => new(Math.Abs(vector.X), Math.Abs(vector.Y));
|
||||
public static Vector2D Normalize(Vector2D vector) => vector / Length(vector);
|
||||
public static Vector2D Reflect(Vector2D vector, Vector2D normal) => vector - 2f * Dot(vector, normal) * normal;
|
||||
public static Vector2D FromTo(Vector2D from, Vector2D to) => to - from;
|
||||
|
|
Loading…
Reference in New Issue