Convex hull is simply a convex polygon so you can easily try {this} or {this} to find area of 2D polygon.
Something like the following (our version):
def PolyArea2D(pts):
lines = np.hstack([pts,np.roll(pts,-1,axis=0)])
area = 0.5*abs(sum(x1*y2-x2*y1 for x1,y1,x2,y2 in lines))
return area
in which pts is array of polygon's vertices i.e., a (nx2) array.
Full usage:
import numpy as np
def PolyArea2D(pts):
lines = np.hstack([pts,np.roll(pts,-1,axis=0)])
area = 0.5*abs(sum(x1*y2-x2*y1 for x1,y1,x2,y2 in lines))
return area
pts = [[0,0],[1,0],[1,1],[0,1]]
print PolyArea2D(pts)
pts = [[0,0],[1,0],[0,1]]
print PolyArea2D(pts)
pts = [[0,0],[1,0],[0.5,0.5]]
print PolyArea2D(pts)
>>>
1.0
0.5
0.25