DOC: Convex Hull areas are actually perimeters for 2-dimensional input #12290
Labels
Documentation
Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org
Milestone
In
scipy.spatial.ConvexHull
, convex hulls expose anarea
andvolume
attribute. These are built on top of QHull. A user who computes a convex hull on 2-dimensional data will be surprised to find QHull's definitions ofvolume
andarea
are dimension-dependent.So,
convex_hull.area
returns the perimeter of a shape in 2-d and the area of the shape in 3-d. In order for you to get the area of a 2-d convex hull, you need to useconvex_hull.volume
.I would think it's appropriate to force
volume
to zero andarea
to Qhull's volume so thatarea
has a consistent meaning across2d
and3d+
for other packages (likeshapely
). Otherwise, we should modify the docstrings to read:Let me know what's preferred & I can submit a fix.
Reproducing code example:
Scipy/Numpy/Python version information:
I'm on scipy 1.4.1, numpy 1.18.1, and Python 3.8.2
The text was updated successfully, but these errors were encountered: