style: Renamed Parameters point to vector
This commit is contained in:
parent
db9e7dc09e
commit
063473e0b5
|
@ -6,15 +6,15 @@ public record Vector2D(float X, float 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 left, Vector2D right) => new(left.X - right.X, left.Y - right.Y);
|
||||||
public static Vector2D operator *(Vector2D point, float value) => new(point.X * value, point.Y * value);
|
public static Vector2D operator *(Vector2D vector, float value) => new(vector.X * value, vector.Y * value);
|
||||||
public static Vector2D operator /(Vector2D point, float value) => new(point.X / value, point.Y / value);
|
public static Vector2D operator /(Vector2D vector, float value) => new(vector.X / value, vector.Y / value);
|
||||||
|
|
||||||
public static float Length(Vector2D point) => MathF.Sqrt(LengthSquared(point));
|
public static float Length(Vector2D vector) => MathF.Sqrt(LengthSquared(vector));
|
||||||
public static float LengthSquared(Vector2D point) => point.X * point.X + point.Y * point.Y;
|
public static float LengthSquared(Vector2D vector) => vector.X * vector.X + vector.Y * vector.Y;
|
||||||
|
|
||||||
public static float Distance(Vector2D from, Vector2D to) => Length(FromTo(from, to));
|
public static float Distance(Vector2D from, Vector2D to) => Length(FromTo(from, to));
|
||||||
|
|
||||||
public static Vector2D Normalize(Vector2D point) => point / Length(point);
|
public static Vector2D Normalize(Vector2D vector) => vector / Length(vector);
|
||||||
public static Vector2D FromTo(Vector2D from, Vector2D to) => to - from;
|
public static Vector2D FromTo(Vector2D from, Vector2D to) => to - from;
|
||||||
|
|
||||||
public static float Cross(Vector2D left, Vector2D right) => left.X * right.Y - left.Y * right.X;
|
public static float Cross(Vector2D left, Vector2D right) => left.X * right.Y - left.Y * right.X;
|
||||||
|
|
|
@ -2,11 +2,11 @@ namespace Syntriax.Engine.Physics2D.Primitives;
|
||||||
|
|
||||||
public static class Vector2DExtensions
|
public static class Vector2DExtensions
|
||||||
{
|
{
|
||||||
public static float Length(this Vector2D point) => Vector2D.Length(point);
|
public static float Length(this Vector2D vector) => Vector2D.Length(vector);
|
||||||
public static float LengthSquared(this Vector2D point) => Vector2D.LengthSquared(point);
|
public static float LengthSquared(this Vector2D vector) => Vector2D.LengthSquared(vector);
|
||||||
public static float Distance(this Vector2D from, Vector2D to) => Vector2D.LengthSquared(point);
|
public static float Distance(this Vector2D from, Vector2D to) => Vector2D.LengthSquared(vector);
|
||||||
|
|
||||||
public static Vector2D Normalize(this Vector2D point) => Vector2D.Normalize(point);
|
public static Vector2D Normalize(this Vector2D vector) => Vector2D.Normalize(vector);
|
||||||
public static Vector2D FromTo(this Vector2D from, Vector2D to) => Vector2D.FromTo(from, to);
|
public static Vector2D FromTo(this Vector2D from, Vector2D to) => Vector2D.FromTo(from, to);
|
||||||
|
|
||||||
public static float Cross(this Vector2D left, Vector2D right) => Vector2D.Cross(left, right);
|
public static float Cross(this Vector2D left, Vector2D right) => Vector2D.Cross(left, right);
|
||||||
|
|
Loading…
Reference in New Issue