tetrahedralize#

cherab.lhd.emc3.cython.tetrahedralize(cells)#

Generate tetrahedral indices from cell indices array.

One cubic-like cell having 8 vertices is divided to 6 tetrahedra.

Parameters:
cells(N, 8) ndarray

Cell indices 2D array.

Returns:
(6N, 4) ndarray

Tetrahedra indices array.

Examples

>>> import numpy as np
>>> from cherab.lhd.emc3.cython import tetrahedralize
>>>
>>> array = np.arange(16, dtype=np.uint32).reshape((2, -1))
>>> array
array([[ 0,  1,  2,  3,  4,  5,  6,  7],
       [ 8,  9, 10, 11, 12, 13, 14, 15]], dtype=uint32)
>>> tetrahedralize(array)
array([[ 6,  2,  1,  0],
       [ 7,  3,  2,  0],
       [ 0,  7,  6,  2],
       [ 1,  5,  6,  4],
       [ 0,  4,  6,  7],
       [ 6,  4,  0,  1],
       [14, 10,  9,  8],
       [15, 11, 10,  8],
       [ 8, 15, 14, 10],
       [ 9, 13, 14, 12],
       [ 8, 12, 14, 15],
       [14, 12,  8,  9]], dtype=uint32)