1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 19:22:56 +08:00

Invert if statement

This commit is contained in:
Naxess 2021-03-22 19:09:28 +01:00
parent 6911a1b415
commit 80e7c3aba7

View File

@ -211,8 +211,9 @@ namespace osu.Game.Rulesets.Objects
// An almost linear arrangement of points results in radius approaching infinity,
// we should prevent that to avoid memory exhaustion when drawing / approximating
if (pathType == PathType.PerfectCurve)
{
if (pathType != PathType.PerfectCurve)
return;
Vector2[] points = pointsInSegment.Select(point => point.Position.Value).ToArray();
if (points.Length < 3)
return;
@ -242,13 +243,6 @@ namespace osu.Game.Rulesets.Objects
if (Math.Abs(det) < threshold)
pointsInSegment[0].Type.Value = PathType.Bezier;
}
// where the latter is much faster, hence differing thresholds
bool exterior = abSq > acSq || bcSq > acSq;
float threshold = exterior ? 0.05f : 0.001f;
if (Math.Abs(det) < threshold)
pointsInSegment[0].Type.Value = PathType.Bezier;
}
private void invalidate()
{