Search code examples
algorithmmathgeometryintersectionpoint-clouds

Drawing a line between a two disjoint sets of points


So, I have a set of points that I have split into two disjoint sets by intersection the set with a plane. Some of the points end up above the plane, some of the points end up below the plane. So the two sets are above and below the plane now.

What would be the best method of drawing a line between these two sets on the plane? I want to draw the line between the closet points in the sets showing nearly exactly where the set is split up.


Solution

  • I'd start by reducing the two sets to their respective convex hulls. This might also drastically simplify the problem.

    You can then proceed following this suggestion.

    What you're looking for is the maximum margin separator; depending on your language, there are libraries for that (I remember seeing one in Python). Some details on one of the algorithms performing this can be found here.