public bool PointIsCloseToOtherPoints(Point p) { if (!points.Any()) { return(false); } int widthX = (int)(epsilon * pointarray.GetLength(0) / width) + 1; int widthY = (int)(epsilon * pointarray.GetLength(1) / height) + 1; for (int counterx = (p.X * pointarray.GetLength(0) / width) - widthX; counterx <= (p.X * pointarray.GetLength(0) / width) + widthY; counterx++) { for (int countery = (p.Y * pointarray.GetLength(1) / height) - widthY; countery <= (p.Y * pointarray.GetLength(1) / height) + widthY; countery++) { int x = ReturnInRangeRightClosed(counterx, 0, pointarray.GetLength(0)); int y = ReturnInRangeRightClosed(countery, 0, pointarray.GetLength(1)); foreach (Point i in pointarray[x, y]) { double d = double.PositiveInfinity; if (i != p) { d = DistanceComputer.ComputeSquaredDistance(p, i); } if (d <= epsilon * epsilon) { return(true); } } } } return(false); }
public bool PointIsCloseToOtherPoints(Point p) { foreach (Point i in points) { double d = double.PositiveInfinity; if (p != i) { d = DistanceComputer.ComputeSquaredDistance(p, i); } if (d <= epsilon * epsilon) { return(true); } } return(false); }