Added nearest function to retrieve nearest object to a point

Added this since I needed to be able to retrieve the object closest to a given point.

Not particularly happy with the _distance function, I'm sure that this could be optimized as it seems to have more comparisons than are strictly necessary.