skspatial.measurement.volume_tetrahedron

skspatial.measurement.volume_tetrahedron(point_a: Union[ndarray, Sequence], point_b: Union[ndarray, Sequence], point_c: Union[ndarray, Sequence], point_d: Union[ndarray, Sequence]) float64[source]

Return the volume of a tetrahedron defined by four points.

The points are the vertices of the tetrahedron. They must be 3D or less.

Parameters
point_a, point_b, point_c, point_darray_like

The four vertices of the tetrahedron.

Returns
np.float64

The volume of the tetrahedron.

References

http://mathworld.wolfram.com/Tetrahedron.html

Examples

>>> from skspatial.measurement import volume_tetrahedron
>>> volume_tetrahedron([0, 0], [3, 2], [-3, 5], [1, 8])
0.0
>>> volume_tetrahedron([0, 0, 0], [2, 0, 0], [1, 1, 0], [0, 0, 1]).round(3)
0.333
>>> volume_tetrahedron([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]).round(3)
0.167