-->

Qhull Convex hull wants me to input at least 3 poi

2019-07-29 09:44发布

问题:

Update: I've decided to try to use a linear programming package in order to determine if the vertices of the two polytopes are linearly separable. (The vertices are really my data, not the polytopes.) I think this will work better, so I no longer need an answer to this question.

I'm writing some code that involves checking if certain polytopes are disjoint. These polytopes are defined by the convex hulls of their vertices, and I'm creating the convex hulls using Qhull. In particular, I'm using the method:

from scipy.spatial import ConvexHull

This works fine, except that sometimes my sets have only 2 or 1 points in them. Qhull doesn't like this, and it spits out this error:

QhullError: QH6214 qhull input error: not enough points(1) to construct initial simplex (need 3)

While executing: | qhull i Qt Options selected for Qhull 2015.2.r 2016/01/18: run-id 109084531 incidence Qtriangulate _pre-merge _zero-centrum

While I can deal with this by writing some subroutines that catch the situation that there are less than 3 points, it's frustrating that Qhull doesn't deal with this case. So I'm looking for:

1) A simple way to make Qhull deal with this correctly

or

2) An alternative package to use

Thank you!

回答1:

QHull doesn't really have to handle the polytopes of one or two vertices (or d-1 vertices in dimension d) as they are perforce their own convex hulls (and they are simplices).

Check for a low number and transfer the input to the output.