1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Correct 4+ point perfect curves to Bezier

This commit is contained in:
Naxess 2021-04-08 12:33:43 +02:00
parent 7d2b54ca42
commit 9a675a2219

View File

@ -213,10 +213,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
if (ControlPoint.Type.Value != PathType.PerfectCurve)
return;
ReadOnlySpan<Vector2> points = PointsInSegment.Select(p => p.Position.Value).ToArray();
if (points.Length != 3)
if (PointsInSegment.Count > 3)
ControlPoint.Type.Value = PathType.Bezier;
if (PointsInSegment.Count != 3)
return;
ReadOnlySpan<Vector2> points = PointsInSegment.Select(p => p.Position.Value).ToArray();
RectangleF boundingBox = PathApproximator.CircularArcBoundingBox(points);
if (boundingBox.Width >= 640 || boundingBox.Height >= 480)
ControlPoint.Type.Value = PathType.Bezier;