25 lines
524 B
C#
25 lines
524 B
C#
using System.Collections.Generic;
|
|
using Assets.Common;
|
|
|
|
namespace Assets.Utils
|
|
{
|
|
public class PointProximityComparer : IEqualityComparer<Point>
|
|
{
|
|
double _threshold;
|
|
|
|
public PointProximityComparer(double threshold = 0.2)
|
|
{
|
|
_threshold = threshold;
|
|
}
|
|
|
|
public bool Equals(Point x, Point y)
|
|
{
|
|
return Point.Dist(x, y) < _threshold;
|
|
}
|
|
|
|
public int GetHashCode(Point obj)
|
|
{
|
|
return obj.GetHashCode();
|
|
}
|
|
}
|
|
} |