cherab.imas.math.tetrahedralize.calculate_tetra_volumeΒΆ

cherab.imas.math.tetrahedralize.calculate_tetra_volume(vertices, tets)ΒΆ

Calculate the volume of tetrahedra.

Parameters:
vertices : ndarray [numpy.float64]ΒΆ

Vertices of tetrahedra.

tets : ndarray [numpy.int32]ΒΆ

Tetrahedra indices.

Returns:

Volume of tetrahedra.

Return type:

float

Examples

>>> vertices = np.array([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
>>> tetras = np.array([[0, 1, 2, 3]], dtype=np.int32)
>>> calculate_tetra_volume(vertices, tetras)
0.16666666666666666