Qhull Convex hull wants me to input at least 3 points

北慕城南 提交于 2019-12-11 06:09:19

问题


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.



来源:https://stackoverflow.com/questions/50185446/qhull-convex-hull-wants-me-to-input-at-least-3-points

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!