Subject: Re: Minimum distance between objects in 2D
Date: Tue, 13 Jan 1998 23:50:39 -0500
From: Alex Bogomolny
I am not aware of a book that evaluates distance for all the possible combinations of your shapes. But the task seems pretty simple.
I believe you can easily establish all the distances from a few formulas:
- Distance between two points
- Distance between a straight line and a point
- Distance between a circle and a point
- Distance between a circle and a straight line.
Examples (assuming the shapes do not intersect):
- Distance between two rectangles is the shortest distance between their vertices.
- Distance between an arc and a square is the shortest distance between the corresponding circle and vertices of the square and the endpoints of the arc and the vertices.
In the chapter of his book "Algorithms" devoted to Geometric algorithms, Robert Sedgewick gives a natural advice at how to sort a set of points in search of the minimal pairwise distance. Since your problem is ultimately reducible to this one, I would consider a question of sorting your points before applying the formulas.