mymesh.contour.MarchingTriangles#
- mymesh.contour.MarchingTriangles(TriNodeCoords, TriNodeConn, NodeValues, threshold=0, interpolation='linear', Type='surf', mixed_elements=False, flip=False, return_NodeValues=False, return_ParentIds=False, cleanup_tol=1e-10, cleanup=True)[source]#
Marching tetrahedra algorithm for extracting an isoline from a triangular mesh. This can be used to generate either a surface mesh of the region above or below the threshold or a line mesh of the isoline. Note that this method is different than the Marching Triangles algorithm by [HSIW96] and is instead analogous to the other “marching” contouring algorithms.
- Parameters:
TriNodeCoords (array_like) – Node coordinates for the input triangular mesh
TriNodeConn (array_like) – Node connectivity for the input triangular mesh. All elements must be triangles.
NodeValues (array_like) – Values at each node in the mesh that are used to extract the isoline
threshold (int, optional) – Isoline level, 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’ - Linear interpolation is performed between adjacent nodes on the input mesh.
Type (str, optional) – Determines whether to generate a surface mesh (‘surf’) or volume mesh (‘vol’), by default ‘surf’
mixed_elements (bool, optional) – If True and Type=’surf’, the generated mesh will have mixed element types (triangles/quadrilateral otherwise a single element type (triangles), by default False.
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.
return_NodeValues (bool, optional) – Return the node values for each node in the triangular mesh. If Type=’line’, these will all be threshold, if Type=’surf’, these will be threshold for the boundary nodes and the original grid values for the interior nodes
return_ParentIds (bool, optional) – Return Ids that refer to the original triangles that each of the new elements is connected to, by default False.
cleanup_tol (float, optional) – Tolerance value used to classify whether two nodes are sufficiently close to be considered a single node (see
mymesh.utils.DeleteDuplicateNodes()
), by default 1e-12.
- Returns:
NodeCoords (np.ndarray) – Node coordinates of the generated mesh
NodeConn (list) – Node connetivity for the generated mesh
NewValues (np.ndarray, optional) – Node values transfered to the generated mesh, returned if return_NodeValues=True
ParentIds (np.ndarray, optional) – Element ids that refer to the original triangles that each of the new elements is connected to, returned if return_ParentIds=True
Examples