mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 00:13:10 +08:00
Add PointsInSegment method
This commit is contained in:
parent
bee2f55d00
commit
7a2cb526e4
@ -156,6 +156,38 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
return interpolateVertices(indexOfDistance(d), d);
|
return interpolateVertices(indexOfDistance(d), d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the control points belonging to the same segment as the one given.
|
||||||
|
/// The first point has a PathType which all other points inherit.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="controlPoint">One of the control points in the segment.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<PathControlPoint> PointsInSegment(PathControlPoint controlPoint)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
List<PathControlPoint> pointsInCurrentSegment = new List<PathControlPoint>();
|
||||||
|
foreach (PathControlPoint point in ControlPoints)
|
||||||
|
{
|
||||||
|
if (point.Type.Value is PathType)
|
||||||
|
{
|
||||||
|
if (!found)
|
||||||
|
pointsInCurrentSegment.Clear();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pointsInCurrentSegment.Add(point);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pointsInCurrentSegment.Add(point);
|
||||||
|
|
||||||
|
if (point == controlPoint)
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pointsInCurrentSegment;
|
||||||
|
}
|
||||||
|
|
||||||
private void invalidate()
|
private void invalidate()
|
||||||
{
|
{
|
||||||
pathCache.Invalidate();
|
pathCache.Invalidate();
|
||||||
|
Loading…
Reference in New Issue
Block a user