18

The value of the "area" attribute in scipy ConvexHull (see http://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html) object does not seem to be (what I understand to be) the area of the convex hull. On the other hand, the value of "volume" does seem to be the area of the convex hull.

from scipy.spatial import ConvexHull
import numpy

points = numpy.array([[-1,-1], [1,1], [-1, 1], [1,-1]])
hull = ConvexHull(points)

print("Volume is %2.2f" % hull.volume) # Prints 4.00
print("Area is %2.2f" % hull.area) # Prints 8.00

In the above example, I expect the area of the convex hull of the 4 points to be 4.0. That's what the "volume" is. What then does "area" give us?

mjandrews
  • 2,392
  • 4
  • 22
  • 39

2 Answers2

18

Volume and area are 3d concepts, but your data is 2d - a 2x2 square. Its area is 4, and perimeter is 8 (the 2d counterparts).

hpaulj
  • 221,503
  • 14
  • 230
  • 353
  • 3
    God dammit I just spent 2 days debugging everything else in my project before finally questioning `area` actually being an area... Thank you so much for your answer. – max Jan 12 '17 at 09:36
  • Could you please elaborate on this...? Do you mean for 2d case, its area correspond to **hull.volume**? – Tom Feb 15 '19 at 14:04
1

Documentation for scipy.spatial.ConvexHull reads:

area : float
Surface area of the convex hull when input dimension > 2. When input points are 2-dimensional, this is the perimeter of the convex hull.

volume: float
Volume of the convex hull when input dimension > 2. When input points are 2-dimensional, this is the area of the convex hull.

area and volume of a hull are the surface area and volume. 2D objects don't have surface area or volume, but the perimeter is conceptually similar to 3D surface area ignoring the lack of depth, and the area contained by the object is similar to 3D volume but ignoring depth.

Vic
  • 487
  • 8
  • 17