From 684cdefd4d1c52b683b9cf4f5eb4c029fbb8706c Mon Sep 17 00:00:00 2001 From: Thomas Steinfeld Date: Sun, 1 Dec 2024 18:51:51 +0100 Subject: [PATCH] FIX: The out parameter 'isClockwise' must be assigned to before control leaves the current method --- src/SimulationFramework/Polygon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SimulationFramework/Polygon.cs b/src/SimulationFramework/Polygon.cs index 13a5ac7d..f193c722 100644 --- a/src/SimulationFramework/Polygon.cs +++ b/src/SimulationFramework/Polygon.cs @@ -146,6 +146,7 @@ private static bool RayLineIntersect(Vector2 position, Vector2 direction, Vector /// if is convex; otherwise public static bool IsConvex(ReadOnlySpan polygon, [NotNullWhen(true)] out bool? isClockwise) { + isClockwise = null; // for a convex polygon every point will have the same winding value bool isAllClockwise = IsClockwiseWinding(polygon, 0); for (int i = 0; i < polygon.Length; i++) @@ -157,7 +158,6 @@ public static bool IsConvex(ReadOnlySpan polygon, [NotNullWhen(true)] o } } - isClockwise = null; return false; // determines the winding order at a specific vertex