fix: Build Errors

This commit is contained in:
2024-01-22 18:46:51 +03:00
parent 0519adfcce
commit 8af2379afa
4 changed files with 19 additions and 19 deletions

View File

@@ -99,7 +99,7 @@ public record Line(Vector2 From, Vector2 To)
float t = (pointVector.X * edgeVector.X + pointVector.Y * edgeVector.Y) / (edgeVector.X * edgeVector.X + edgeVector.Y * edgeVector.Y);
// Clamp t to the range [0, 1] to ensure the closest point is on the edge
t = Math.Max(0, Math.Min(1, t));
t = MathF.Max(0, MathF.Min(1, t));
// Calculate the closest point on the edge
float closestX = From.X + t * edgeVector.X;

View File

@@ -16,15 +16,15 @@ public record Shape(IList<Vector2> Vertices)
foreach (Vector2 point in Vertices)
{
minX = Math.Min(minX, point.X);
minY = Math.Min(minY, point.Y);
maxX = Math.Max(maxX, point.X);
maxY = Math.Max(maxY, point.Y);
minX = MathF.Min(minX, point.X);
minY = MathF.Min(minY, point.Y);
maxX = MathF.Max(maxX, point.X);
maxY = MathF.Max(maxY, point.Y);
}
float dx = maxX - minX;
float dy = maxY - minY;
float deltaMax = Math.Max(dx, dy);
float deltaMax = MathF.Max(dx, dy);
float midX = (minX + maxX) / 2;
float midY = (minY + maxY) / 2;

View File

@@ -6,7 +6,7 @@ namespace Syntriax.Engine.Physics2D.Primitives;
public record Triangle(Vector2 A, Vector2 B, Vector2 C)
{
public float Area => Math.Abs((
public float Area => MathF.Abs((
A.X * (B.Y - C.Y) +
B.X * (C.Y - A.Y) +
C.X * (A.Y - B.Y)
@@ -23,7 +23,7 @@ public record Triangle(Vector2 A, Vector2 B, Vector2 C)
float slopeBC = (C.Y - B.Y) / (C.X - B.X);
Vector2 center;
if (Math.Abs(slopeAB - slopeBC) > float.Epsilon)
if (MathF.Abs(slopeAB - slopeBC) > float.Epsilon)
{
float x = (slopeAB * slopeBC * (A.Y - C.Y) + slopeBC * (A.X + B.X) - slopeAB * (B.X + C.X)) / (2 * (slopeBC - slopeAB));
float y = -(x - (A.X + B.X) / 2) / slopeAB + (A.Y + B.Y) / 2;