Files
HawkeyeVision/Plugins/CandyboxPlugin/Voronoi/Edge.cs
2025-09-16 10:42:43 +02:00

31 lines
914 B
C#

namespace CandyboxPlugin.Voronoi
{
public class Edge
{
public VoronoiPoint Point1 { get; }
public VoronoiPoint Point2 { get; }
public Edge(VoronoiPoint point1, VoronoiPoint point2)
{
Point1 = point1;
Point2 = point2;
}
public override bool Equals(object obj)
{
if (obj == null) return false;
if (obj.GetType() != GetType()) return false;
var edge = obj as Edge;
var samePoints = Point1 == edge.Point1 && Point2 == edge.Point2;
var samePointsReversed = Point1 == edge.Point2 && Point2 == edge.Point1;
return samePoints || samePointsReversed;
}
public override int GetHashCode()
{
int hCode = (int)Point1.X ^ (int)Point1.Y ^ (int)Point2.X ^ (int)Point2.Y;
return hCode.GetHashCode();
}
}
}