-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenericVertex.cs
More file actions
24 lines (20 loc) · 944 Bytes
/
GenericVertex.cs
File metadata and controls
24 lines (20 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using RT.Geometry;
namespace RT.Coordinates;
/// <summary>
/// Represents a vertex with an explicitly specified X and Y coordinate.</summary>
/// <param name="baseObject">
/// A base object used for equality comparison. Note that differing vertices must use different objects here.</param>
/// <param name="point">
/// The coordinates of this vertex.</param>
public class GenericVertex(object baseObject, PointD point) : Vertex
{
private readonly object _baseObject = baseObject;
/// <inheritdoc/>
public override PointD Point => point;
/// <inheritdoc/>
public override bool Equals(Vertex other) => other is GenericVertex gen && gen._baseObject.Equals(_baseObject);
/// <inheritdoc/>
public override bool Equals(object obj) => obj is GenericVertex gen && gen._baseObject.Equals(_baseObject);
/// <inheritdoc/>
public override int GetHashCode() => unchecked(_baseObject.GetHashCode() + 3);
}