refactor: renamed primitives
This commit is contained in:
@@ -5,8 +5,8 @@ namespace Syntriax.Engine.Physics2D;
|
||||
|
||||
public static partial class Physics2D
|
||||
{
|
||||
public static bool Overlaps(this Shape shape, Vector2D point) => Overlaps(shape, point, out float _);
|
||||
public static bool Overlaps(this Shape shape, Vector2D point, out float depth)
|
||||
public static bool Overlaps(this Shape2D shape, Vector2D point) => Overlaps(shape, point, out float _);
|
||||
public static bool Overlaps(this Shape2D shape, Vector2D point, out float depth)
|
||||
{
|
||||
depth = float.MaxValue;
|
||||
System.Collections.Generic.IReadOnlyList<Vector2D> vertices = shape.Vertices;
|
||||
@@ -16,7 +16,7 @@ public static partial class Physics2D
|
||||
{
|
||||
Vector2D projectionVector = vertices[indexProjection].FromTo(vertices[(indexProjection + 1) % count]).Perpendicular().Normalized;
|
||||
|
||||
Projection shapeProjection = shape.ToProjection(projectionVector);
|
||||
Projection1D shapeProjection = shape.ToProjection(projectionVector);
|
||||
float projectedPoint = point.Dot(projectionVector);
|
||||
|
||||
if (shapeProjection.Max < projectedPoint || shapeProjection.Min > projectedPoint)
|
||||
@@ -90,5 +90,5 @@ public static partial class Physics2D
|
||||
return originalTriangleArea.ApproximatelyEquals(pointTriangleAreasSum, float.Epsilon * 3f);
|
||||
}
|
||||
|
||||
public static bool LaysOn(this Vector2D point, Line line) => Line.Intersects(line, point);
|
||||
public static bool LaysOn(this Vector2D point, Line2D line) => Line2D.Intersects(line, point);
|
||||
}
|
||||
|
Reference in New Issue
Block a user