How to calculate distance from a point to a line segment, on a sphere?

Here’s my own solution, based on the idea in ask Dr. Math. I’d be happy to see your feedback. Disclaimer first. This solution is correct for spheres. Earth isn’t a sphere, and the coordinates system (WGS 84) doesn’t assume it’s a sphere. So this is just an approximation, and I can’t really estimate is error. … Read more

Determine non-convex hull of collection of line segments

Pick a safe starting point. Can be e.g. the endpoint with maximum x. March along the line segment. Upon encountering any intersection, always turn left and march along this new segment. Upon encountering an endpoint, record it. Goto 2. Stop when you have returned to your starting point. Your list of recorded endpoints now makes … Read more

How do I derive a Voronoi diagram given its point set and its Delaunay triangulation?

The Voronoi diagram is just the dual graph of the Delaunay triangulation. So, the edges of the Voronoi diagram are along the perpendicular bisectors of the edges of the Delaunay triangulation, so compute those lines. Then, compute the vertices of the Voronoi diagram by finding the intersections of adjacent edges. Finally, the edges are then … Read more

Position N circles of different radii inside a larger circle without overlapping

Not a solution, just a brainstorming idea: IIRC one common way to get approximate solutions to the TSP is to start with a random configuration, and then applying local operations (e.g. “swapping” two edges in the path) to try and get shorter and shorter paths. (Wikipedia link) I think something similar would be possible here: … Read more