I have a sizable game engine and I'd like a feature for finding the nearest of a list of points.
I could simply use the Pythagorean theorem to find the distances. I know I can't simply add x and y, because that's only the distance to the object if you took only right-angled turns. I'm wondering if there's something else I could do.
I also have a collision system, where essentially I turn objects into smaller objects on a smaller grid, kind of like a minimap, and only if objects exist in the same gridspace do I check for collisions. I could do that, only make the grid spacing larger to check for closeness. (Rather than checking every single object.) However, that would take additional setup in my base class and clutter up the already cluttered object.
tl;dr: Is there something efficient and accurate I could detect which object is closest, based on a list of points and sizes?