cherab.imas.math.tetrahedralize.cell_to_5tetraΒΆ
- cherab.imas.math.tetrahedralize.cell_to_5tetra(cells)ΒΆ
Generate tetrahedral indices by dividing one cell into 5 tetrahedra.
One cubic-like cell having 8 vertices can be divided into a minimum of five tetrahedra. Reference: https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/48509/versions/3/previews/COMP_GEOM_TLBX/html/Divide_hypercube_5_simplices_3D.html # noqa: E501
Note
If one side face of the cell is twisted, Adjacent cells do not share a plane with each other. In this case, it is required to alternate combinations of tetrahedra, or simply use
cell_to_6tetra().- Parameters:
- cells : (N,8) ndarray [numpy.int32]ΒΆ
cell indices 2D array, the shape of which is \((N, 8)\), where \(N\) is the number of cells.
- Returns:
tetrahedra indices array, the shape of which is \((5N, 4)\).
- Return type:
(5N,4) ndarray
Examples
>>> import numpy as np >>> from cherab.imas.math.tetrahedralize import cell_to_5tetra >>> >>> array = np.arrange(16, dtype=np.int32).reshape((2, -1)) >>> array array([[ 0, 1, 2, 3, 4, 5, 6, 7], [ 8, 9, 10, 11, 12, 13, 14, 15]], dtype=int32) >>> cell_to_5tetra(array) array([[ 0, 1, 3, 4], [ 1, 3, 4, 6], [ 3, 6, 7, 4], [ 1, 2, 3, 6], [ 1, 6, 4, 5], [ 8, 9, 11, 12], [ 9, 11, 12, 14], [11, 14, 15, 12], [ 9, 10, 11, 14], [ 9, 14, 12, 13]], dtype=int32)