-
Notifications
You must be signed in to change notification settings - Fork 157
Description
The current algorithm computes the bounding box of the polygon, selects the shortest side as the initial cell size, and then tiles the polygon with 1×1, 1×N or N×1 of these initial cells. Following that, it seeds the current best interior distance with the better of the bounds center or the polygon centroid.
Since the remainder of the algorithm has all the machinery to test and subdivide cells, we can rely on this and simplify the initial setup.
Instead of choosing the smallest side of the bounding box, choose the largest side, to compute the square cell that fully and tightly contains the polygon. Initialize the priority queue with this single cell, eliminating the tiling code from the original algorithm. Further, because this cell contains the bounds center (which is identical to the rectangular bounds center), you do not need to compute and choose between two initial best values — just use the polygon centroid distance.
Tested in my implementation, and works great.