From 3338d2eee8edf905ff9b1b5a64ea8457af15479a Mon Sep 17 00:00:00 2001 From: Noah Stolk <31079637+NoahStolk@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:49:57 +0200 Subject: [PATCH] Remove unnecessary parentheses --- src/Detach/Collisions/Geometry2D.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Detach/Collisions/Geometry2D.cs b/src/Detach/Collisions/Geometry2D.cs index 36b499e..514cd10 100644 --- a/src/Detach/Collisions/Geometry2D.cs +++ b/src/Detach/Collisions/Geometry2D.cs @@ -73,7 +73,7 @@ public static bool LineLine(LineSegment2D line1, LineSegment2D line2) float Cross(Vector2 v1, Vector2 v2) { - return (v1.X * v2.Y) - (v1.Y * v2.X); + return v1.X * v2.Y - v1.Y * v2.X; } } @@ -97,8 +97,8 @@ public static bool LineRectangle(LineSegment2D line, Rectangle rectangle) return true; Vector2 norm = Vector2.Normalize(line.End - line.Start); - norm.X = (norm.X != 0) ? 1 / norm.X : 0; - norm.Y = (norm.Y != 0) ? 1 / norm.Y : 0; + norm.X = norm.X != 0 ? 1 / norm.X : 0; + norm.Y = norm.Y != 0 ? 1 / norm.Y : 0; Vector2 min = (rectangle.GetMin() - line.Start) * norm; Vector2 max = (rectangle.GetMax() - line.Start) * norm; @@ -107,7 +107,7 @@ public static bool LineRectangle(LineSegment2D line, Rectangle rectangle) if (tMax < 0 || tMin > tMax) return false; - float t = (tMin < 0) ? tMax : tMin; + float t = tMin < 0 ? tMax : tMin; return t > 0 && t * t < line.LengthSquared; }