bool equal(Coordinate a, Coordinate b, double tolerance) { if (tolerance == 0) { return a.equals(b); } return a.distance(b) <= tolerance; }