Approximates the distance between two points. The returned value can be up to 6% wrong in the worst case.
Source
static double distanceBetweenPoints(Point a, Point b) { double dx = a.x - b.x; double dy = a.y - b.y; if (dx < 0.0) dx = -dx; if (dy < 0.0) dy = -dy; if (dx > dy) { return dx + dy/2.0; } else { return dy + dx/2.0; } }