fix: Reflect
This commit is contained in:
parent
8af2379afa
commit
75e6e06099
|
@ -23,7 +23,7 @@ public record Vector2D(float X, float 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 vector) => vector / Length(vector);
|
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 Reflect(Vector2D vector, Vector2D normal) => vector - 2f * (vector - Dot(vector, normal) * normal);
|
||||||
public static Vector2D FromTo(Vector2D from, Vector2D to) => to - from;
|
public static Vector2D FromTo(Vector2D from, Vector2D to) => to - from;
|
||||||
public static Vector2D Scale(Vector2D vector, Vector2D scale) => new(vector.X * scale.X, vector.Y * scale.Y);
|
public static Vector2D Scale(Vector2D vector, Vector2D scale) => new(vector.X * scale.X, vector.Y * scale.Y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue