Skip to content

Commit c320493

Browse files
committed
Fix incorrect AngleDelta code
Should've double checked the code.
1 parent fed59fe commit c320493

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

osu.Game.Rulesets.Sentakki/Extensions/MathExtensions.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@ public static float NormalizeAngle(this float angle)
2121
/// GetDeltaAngle(a,b) = -20
2222
/// </code>
2323
/// </example>
24-
public static float AngleDelta(float a, float b) => (b - a).Mod(360);
24+
public static float AngleDelta(float a, float b)
25+
{
26+
float delta = b - a;
27+
28+
delta %= 360;
29+
30+
if (delta < -180)
31+
delta += 360;
32+
else if (delta > 180)
33+
delta -= 360;
34+
35+
return delta;
36+
}
2537

2638
/// <summary>
2739
/// Computes the angle (in degrees) of <c>target</c> around <c>origin</c>

0 commit comments

Comments
 (0)