I am trying to create a convex hull using the Scipy and ConvexHull libraries. As far as I know, he calls QHull.
The problem occurs when the points that I want to add do not have a “full dimension”. Example:
from scipy.spatial import ConvexHull
import numpy as np
points = np.append([[0,2]],[[2,0]],axis=0)
hull = ConvexHull(points)
Has for output:
Traceback (most recent call last):
File "C:/folder/vertices_scipy2.py", line 5, in <module>
hull = ConvexHull(points)
File "scipy\spatial\qhull.pyx", line 2230, in scipy.spatial.qhull.ConvexHull.__init__ (scipy\spatial\qhull.c:20317)
File "scipy\spatial\qhull.pyx", line 328, in scipy.spatial.qhull._Qhull.__init__ (scipy\spatial\qhull.c:3639)
QhullError: Qhull error
However, if I add extra points, so that the convex hull has full dimension:
from scipy.spatial import ConvexHull
import numpy as np
points = np.append([[0,0],[0,2]],[[2,0]],axis=0)
hull = ConvexHull(points)
then everything works. The difference between one example and another (I made many other examples, so I'm sure) is that the convex hull in the first case is one-dimensional in two-dimensional space, and in the second - 2-dimensional in two-dimensional space (i.e., full the size).
Any ideas? I thought to skip some qhull_options as the docs indicate, as mentioned in the answers, which:
QHullError Raised when Qhull detects an error condition, such as geometric degeneration, when resolution options are not enabled.
However, I read many options in QHull , and none of them seem to fix this problem. I tried some of them at random, with little success.Any help would be helpful. I am working on a program that creates hundreds of these buildings, and some of them are not full-sized.