mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Naming standardisation and enforcing.
This commit is contained in:
@ -10,19 +10,19 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
{
|
||||
public class CircularArcApproximator
|
||||
{
|
||||
private Vector2 A;
|
||||
private Vector2 B;
|
||||
private Vector2 C;
|
||||
private Vector2 a;
|
||||
private Vector2 b;
|
||||
private Vector2 c;
|
||||
|
||||
private int amountPoints;
|
||||
|
||||
private const float TOLERANCE = 0.1f;
|
||||
private const float tolerance = 0.1f;
|
||||
|
||||
public CircularArcApproximator(Vector2 A, Vector2 B, Vector2 C)
|
||||
public CircularArcApproximator(Vector2 a, Vector2 b, Vector2 c)
|
||||
{
|
||||
this.A = A;
|
||||
this.B = B;
|
||||
this.C = C;
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -31,9 +31,9 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
/// <returns>A list of vectors representing the piecewise-linear approximation.</returns>
|
||||
public List<Vector2> CreateArc()
|
||||
{
|
||||
float aSq = (B - C).LengthSquared;
|
||||
float bSq = (A - C).LengthSquared;
|
||||
float cSq = (A - B).LengthSquared;
|
||||
float aSq = (b - c).LengthSquared;
|
||||
float bSq = (a - c).LengthSquared;
|
||||
float cSq = (a - b).LengthSquared;
|
||||
|
||||
// If we have a degenerate triangle where a side-length is almost zero, then give up and fall
|
||||
// back to a more numerically stable method.
|
||||
@ -51,9 +51,9 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
if (Precision.AlmostEquals(sum, 0))
|
||||
return new List<Vector2>();
|
||||
|
||||
Vector2 centre = (s * A + t * B + u * C) / sum;
|
||||
Vector2 dA = A - centre;
|
||||
Vector2 dC = C - centre;
|
||||
Vector2 centre = (s * a + t * b + u * c) / sum;
|
||||
Vector2 dA = a - centre;
|
||||
Vector2 dC = c - centre;
|
||||
|
||||
float r = dA.Length;
|
||||
|
||||
@ -68,9 +68,9 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
|
||||
// Decide in which direction to draw the circle, depending on which side of
|
||||
// AC B lies.
|
||||
Vector2 orthoAC = C - A;
|
||||
orthoAC = new Vector2(orthoAC.Y, -orthoAC.X);
|
||||
if (Vector2.Dot(orthoAC, B - A) < 0)
|
||||
Vector2 orthoAtoC = c - a;
|
||||
orthoAtoC = new Vector2(orthoAtoC.Y, -orthoAtoC.X);
|
||||
if (Vector2.Dot(orthoAtoC, b - a) < 0)
|
||||
{
|
||||
dir = -dir;
|
||||
thetaRange = 2 * Math.PI - thetaRange;
|
||||
@ -79,12 +79,12 @@ namespace osu.Game.Modes.Osu.Objects
|
||||
// We select the amount of points for the approximation by requiring the discrete curvature
|
||||
// to be smaller than the provided tolerance. The exact angle required to meet the tolerance
|
||||
// is: 2 * Math.Acos(1 - TOLERANCE / r)
|
||||
if (2 * r <= TOLERANCE)
|
||||
if (2 * r <= tolerance)
|
||||
// This special case is required for extremely short sliders where the radius is smaller than
|
||||
// the tolerance. This is a pathological rather than a realistic case.
|
||||
amountPoints = 2;
|
||||
else
|
||||
amountPoints = Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - TOLERANCE / r))));
|
||||
amountPoints = Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - tolerance / r))));
|
||||
|
||||
List<Vector2> output = new List<Vector2>(amountPoints);
|
||||
|
||||
|
Reference in New Issue
Block a user