If all four corners of a spherical (but actually WGS84/elliptical) rectangle are closest to a given point p
in a set S
, does that necessarily mean all points inside the rectangle are also closest to p
?
By spherical rectangle, I mean a polygon with coordinates:
{lon1, lat1}, {lon1, lat2}, {lon2, lat2}, {lon2, lat1}, {lon1,lat1}
(with the last point just to close off the polygon if necessary) for two longitudes lon1 and lon2 and two latitudes lat1 and lat2.
These are lines of constant latitude and longitude, not geodesics.
I'm trying to coax Mathematica into creating a geographical Voronoi map (https://github.com/barrycarter/bcapps/blob/master/REDDIT/bc-metro.m). This isn't too hard to do if I assume the Earth is spherical, but, I've decided to do this using the Earth's true shape, or at least WGS84.
Mathematica does have a WGS84 accurate GeoDistance
function, but it's expensive to evaluate, so I want to use it as few times as possible.
My plan is to break up my region into latitude/longitude rectangles, and, if the 4 corner points are all closest to the same point in my set, assume the entire rectangular region is also closest to that point.
I'm pretty sure I could prove this on a perfect sphere, but I'm worried that it might not be true on an ellipsoid.
I created http://test.barrycarter.info/gmap8.php using this technique (https://github.com/barrycarter/bcapps/blob/master/MAPS/bc-closest-gmap.pl but the code is currently commented out since I tried to use qhull instead), but I have no idea if it's 100% accurate.