mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add function of computing position range occupied by hit objects
This commit is contained in:
33
osu.Game.Rulesets.Catch/Edit/PositionRange.cs
Normal file
33
osu.Game.Rulesets.Catch/Edit/PositionRange.cs
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Edit
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a closed interval of horizontal positions in the playfield.
|
||||
/// </summary>
|
||||
public readonly struct PositionRange
|
||||
{
|
||||
public readonly float Min;
|
||||
public readonly float Max;
|
||||
|
||||
public PositionRange(float value)
|
||||
: this(value, value)
|
||||
{
|
||||
}
|
||||
|
||||
public PositionRange(float min, float max)
|
||||
{
|
||||
Min = min;
|
||||
Max = max;
|
||||
}
|
||||
|
||||
public static PositionRange Union(PositionRange a, PositionRange b) => new PositionRange(Math.Min(a.Min, b.Min), Math.Max(a.Max, b.Max));
|
||||
|
||||
public static readonly PositionRange EMPTY = new PositionRange(float.PositiveInfinity, float.NegativeInfinity);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user