before candybox editor update
This commit is contained in:
31
Plugins/CandyboxPlugin/Voronoi/Edge.cs
Normal file
31
Plugins/CandyboxPlugin/Voronoi/Edge.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user