1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:12:56 +08:00

Use a cleaner distance function

This commit is contained in:
smoogipoo 2019-10-16 19:32:45 +09:00
parent f3c38ae089
commit 5ac5e34f85

View File

@ -18,13 +18,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override void CreateContent(Vector2 centrePosition)
{
float maxDistance = Math.Max(
Vector2.Distance(centrePosition, Vector2.Zero),
Math.Max(
Vector2.Distance(centrePosition, new Vector2(DrawWidth, 0)),
Math.Max(
Vector2.Distance(centrePosition, new Vector2(0, DrawHeight)),
Vector2.Distance(centrePosition, DrawSize))));
float dx = Math.Max(centrePosition.X, DrawWidth - centrePosition.X);
float dy = Math.Max(centrePosition.Y, DrawHeight - centrePosition.Y);
float maxDistance = new Vector2(dx, dy).Length;
int requiredCircles = (int)(maxDistance / DistanceSpacing);