Merge branch 'master' into beatmap-deletion

This commit is contained in:
Thomas Müller
2017-02-24 18:58:06 +01:00
committed by GitHub

View File

@ -29,27 +29,22 @@ namespace osu.Game.Modes.Osu.Objects
case CurveTypes.Linear: case CurveTypes.Linear:
return subControlPoints; return subControlPoints;
case CurveTypes.PerfectCurve: case CurveTypes.PerfectCurve:
// If we have a different amount than 3 control points, use bezier for perfect curves. //we can only use CircularArc iff we have exactly three control points and no dissection.
if (ControlPoints.Count != 3) if (ControlPoints.Count != 3 || subControlPoints.Count != 3)
return new BezierApproximator(subControlPoints).CreateBezier(); break;
else
{
Debug.Assert(subControlPoints.Count == 3);
// Here we have exactly 3 control points. Attempt to fit a circular arc. // Here we have exactly 3 control points. Attempt to fit a circular arc.
List<Vector2> subpath = new CircularArcApproximator(subControlPoints[0], subControlPoints[1], subControlPoints[2]).CreateArc(); List<Vector2> subpath = new CircularArcApproximator(subControlPoints[0], subControlPoints[1], subControlPoints[2]).CreateArc();
// If for some reason a circular arc could not be fit to the 3 given points, fall back to a numerically stable bezier approximation.
if (subpath.Count == 0) if (subpath.Count == 0)
// For some reason a circular arc could not be fit to the 3 given points. Fall back break;
// to a numerically stable bezier approximation.
subpath = new BezierApproximator(subControlPoints).CreateBezier();
return subpath; return subpath;
} }
default:
return new BezierApproximator(subControlPoints).CreateBezier(); return new BezierApproximator(subControlPoints).CreateBezier();
} }
}
private void calculatePath() private void calculatePath()
{ {