1

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!

Francesco Montesano
  • 8,485
  • 2
  • 40
  • 64
Areawoman
  • 233
  • 1
  • 11
  • 1
    just curious, does it complain if your set contains three identical points? – muratgu May 05 '18 at 03:54
  • 1
    @muratgu That's a good idea, I'll try it. – Areawoman May 05 '18 at 04:40
  • 1
    @muratgu Yes, it complains. (And the complaint it gives is: "QhullError: QH6013 qhull input error: input is less than 2-dimensional since it has the same x coordinate.") – Areawoman May 05 '18 at 04:43
  • @muratgu I'm going to use linear programming to find if a linear separator exists, such as explained here (equivalent to the convex halls being disjoint): http://www.joyofdata.de/blog/testing-linear-separability-linear-programming-r-glpk/ – Areawoman May 05 '18 at 05:14

1 Answers1

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.