mymesh.contour.MarchingCubes#
- mymesh.contour.MarchingCubes(VoxelNodeCoords, VoxelNodeConn, NodeValues, threshold=0, interpolation='linear', method='33', flip=False, return_anchors=False)[source]#
Marching cubes algorithm [LC87] for extracting an isosurface from a hexahedral mesh.
- Parameters:
NodeCoords (array_like) – Node coordinates of a two dimensional hexahedral grid (e.g. from primitives.Grid)
NodeConn (array_like) – Node connectivities of a two dimensional grid of rectilinear grid (e.g. from primitives.Grid) of hexahedra.
NodeValues (array_like) – Array of node values corresponding to each node in the mesh.
threshold (int, optional) – Isosurface level that defines the boundary, by default 0
interpolation (str, optional) –
Interpolation to interpolate the position of the new nodes along the edges of the input mesh, by default ‘linear’.
’midpoint’ - No interpolation is performed, new nodes are placed at the midpoint of edges
’linear’ - Bilinear interpolation is performed between adjacent nodes on the input mesh
method (str, optional) – Mesh generation method, either ‘original’ for the original marching cubes algorithm or ‘33’ for the marching cubes 33 algorithm [Che95].
flip (bool, optional) – Flip the interior/exterior of the mesh, by default False. By default, values less than the threshold are assumed to be the “inside” of the mesh. If the inside is denoted by values greater than the threshold, set flip=True.
- Returns:
NewCoords (np.ndarray) – Numpy array of node coordinates for the contour mesh
NewConn (list) – List of node connectivities