1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-10 03:25:41 +00:00

Use auto-property for Polygon and Polyhedron

This ensures a new instance is created
This commit is contained in:
Oliver Booth 2022-06-01 19:11:52 +01:00
parent 32485b727a
commit 0e62f233f0
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
3 changed files with 27 additions and 15 deletions

View File

@ -7,11 +7,6 @@ namespace X10D.Drawing;
/// </summary>
public class Polygon : IEquatable<Polygon>
{
/// <summary>
/// The empty polygon. That is, a polygon with no vertices.
/// </summary>
public static readonly Polygon Empty = new();
private readonly List<Point> _vertices = new();
/// <summary>
@ -38,6 +33,15 @@ public class Polygon : IEquatable<Polygon>
_vertices = new List<Point>(vertices);
}
/// <summary>
/// Gets an empty polygon. That is, a polygon with no vertices.
/// </summary>
/// <value>An empty polygon.</value>
public static Polygon Empty
{
get => new();
}
/// <summary>
/// Returns a value indicating whether this polygon is convex.
/// </summary>

View File

@ -9,11 +9,6 @@ namespace X10D.Drawing;
/// </summary>
public class PolygonF
{
/// <summary>
/// The empty polygon. That is, a polygon with no vertices.
/// </summary>
public static readonly PolygonF Empty = new();
private readonly List<PointF> _vertices = new();
/// <summary>
@ -67,6 +62,15 @@ public class PolygonF
_vertices = new List<PointF>(vertices);
}
/// <summary>
/// Gets an empty polygon. That is, a polygon with no vertices.
/// </summary>
/// <value>An empty polygon.</value>
public static PolygonF Empty
{
get => new();
}
/// <summary>
/// Returns a value indicating whether this polygon is convex.
/// </summary>

View File

@ -8,11 +8,6 @@ namespace X10D.Drawing;
/// </summary>
public class Polyhedron : IEquatable<Polyhedron>
{
/// <summary>
/// The empty polyhedron. That is, a polyhedron with no points.
/// </summary>
public static readonly Polyhedron Empty = new();
private readonly List<Vector3> _vertices = new();
/// <summary>
@ -48,6 +43,15 @@ public class Polyhedron : IEquatable<Polyhedron>
_vertices = new List<Vector3>(vertices);
}
/// <summary>
/// Gets an empty polyhedron. That is, a polygon with no vertices.
/// </summary>
/// <value>An empty polyhedron.</value>
public static Polyhedron Empty
{
get => new();
}
/// <summary>
/// Returns a value indicating whether this polyhedron is convex.
/// </summary>