triangulate#
- cherab.lhd.emc3.indices.triangulate(grid: Grid, phi: float | None = None, n_phi: int = 0, index_type: Literal['cell', 'physics', 'coarse'] = 'coarse')Source#
Triangulate grid data at a specific toroidal angle.
This method returns vertices and triangles at ploidal plane (R-Z plane) at a specific toroidal angle. The grid is interpolated linearly between two nearest toroidal angles if specifying arbitrary toroidal angle
phi. Also, indices of triangles are returned according to the index type.- Parameters:
- grid
Grid Grid object.
- phi
float,optional Toroidal angle in [degree], by default None. If specified, the grid is interpolated linearly and prioritized over
n_phi.- n_phi
int,optional Index of toroidal angle, by default 0. If specified, the grid is not interpolated and used as is.
- index_type{“cell”, “physics”, “coarse”},
optional Index type, by default “coarse”.
- grid
- Returns:
Examples
>>> grid = Grid("zone0") >>> verts, tris, indices = triangulate(grid, phi=4.2) >>> verts.shape (55200, 2) >>> tri.shape (48600, 3) >>> indices.shape (48600,)