Add separated argument constructor to Circle/F

This commit is contained in:
Oliver Booth 2022-06-01 18:29:12 +01:00
parent b0cce087b3
commit 09393029e8
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 24 additions and 2 deletions

View File

@ -15,7 +15,18 @@ public readonly struct Circle : IEquatable<Circle>, IComparable<Circle>, ICompar
/// <summary> /// <summary>
/// The unit circle. That is, a circle whose center point is (0, 0) and whose radius is 1. /// The unit circle. That is, a circle whose center point is (0, 0) and whose radius is 1.
/// </summary> /// </summary>
public static readonly Circle Unit = new(Point.Empty, 1); public static readonly Circle Unit = new(0, 0, 1);
/// <summary>
/// Initializes a new instance of the <see cref="Circle" /> struct.
/// </summary>
/// <param name="centerX">The X coordinate of the center point.</param>
/// <param name="centerY">The Y coordinate of the center point.</param>
/// <param name="radius">The radius of the circle.</param>
public Circle(int centerX, int centerY, int radius)
: this(new Point(centerX, centerY), radius)
{
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Circle" /> struct. /// Initializes a new instance of the <see cref="Circle" /> struct.

View File

@ -17,7 +17,18 @@ public readonly struct CircleF : IEquatable<CircleF>, IComparable<CircleF>, ICom
/// <summary> /// <summary>
/// The unit circle. That is, a circle whose center point is (0, 0) and whose radius is 1. /// The unit circle. That is, a circle whose center point is (0, 0) and whose radius is 1.
/// </summary> /// </summary>
public static readonly CircleF Unit = new(Vector2.Zero, 1.0f); public static readonly CircleF Unit = new(0f, 0f, 1.0f);
/// <summary>
/// Initializes a new instance of the <see cref="CircleF" /> struct.
/// </summary>
/// <param name="centerX">The X coordinate of the center point.</param>
/// <param name="centerY">The Y coordinate of the center point.</param>
/// <param name="radius">The radius of the circle.</param>
public CircleF(float centerX, float centerY, float radius)
: this(new Vector2(centerX, centerY), radius)
{
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="CircleF" /> struct. /// Initializes a new instance of the <see cref="CircleF" /> struct.