b = tri[:, (0), :2] - tri[:, (2), :2]
proj_area = np.cross(a, b).sum(axis=-1)
zavg = tri[:, :, (2)].sum(axis=1)
vol = zavg * np.abs(proj_area) / 6.0
return vol.sum()
main()
Volume under "plane" defined by data points - python