Algorithm to compute a Voronoi diagram on a sphere?

Update in July 2016: Thanks to a number of volunteers (especially Nikolai Nowaczyk and I), there is now far more robust / correct code for handling Voronoi diagrams on the surface of a sphere in Python. This is officially available as scipy.spatial.SphericalVoronoi from version 0.18 of scipy onwards. There’s a working example of usage and … Read more

How to check if line segment intersects a rectangle?

One very simple option would be to use a standard algorithm for checking whether two line segments intersect to check whether the line segments intersects any of the four line segments that make up the corners of the box. It’s computationally very efficient to check if two line segments intersect, so I would expect that … Read more

What is the most efficient algorithm to find a straight line that goes through most points?

There is likely no solution to this problem that is significantly better than O(n^2) in a standard model of computation. The problem of finding three collinear points reduces to the problem of finding the line that goes through the most points, and finding three collinear points is 3SUM-hard, meaning that solving it in less than … Read more

Find if a point is inside a convex hull for a set of points without computing the hull itself

The problem can be solved by finding a feasible point of a Linear Program. If you’re interested in the full details, as opposed to just plugging an LP into an existing solver, I’d recommend reading Chapter 11.4 in Boyd and Vandenberghe’s excellent book on convex optimization. Set A = (X[1] X[2] … X[n]), that is, … Read more