mymesh.converter#

Mesh conversion tools. This module provides functions for converting between mesh types (e.g. a solid volumetric mesh to a surface mesh) element types (e.g. hexahedral to tetrahedral), and connectivity representations (e.g. element node connectivities to element faces or edges).

Mesh type conversion#

solid2surface(NodeCoords, NodeConn[, ...])

Extract the 2D surface elements from a 3D volume mesh

im2voxel(img, voxelsize[, scalefactor, ...])

Convert 3D image data to a cubic mesh.

mesh2im(NodeCoords, NodeConn, voxelsize[, ...])

Convert a 3D mesh to a binarized image.

voxel2im(VoxelCoords, VoxelConn, Vals)

Convert a rectilinear voxel mesh (grid) to a 3D image matrix.

surf2voxel(SurfCoords, SurfConn, h[, ...])

Convert a surface mesh to a filled voxel mesh.

surf2dual(NodeCoords, SurfConn[, Centroids, ...])

Convert a surface mesh to it's dual mesh.

Connectivity conversion#

solid2faces(NodeCoords, NodeConn[, ...])

Convert solid mesh to faces.

solid2edges(NodeCoords, NodeConn[, ...])

Convert a solid mesh to edges.

surf2edges(NodeCoords, NodeConn[, ElemType])

Extract the edges of an unclosed surface mesh.

EdgesByElement(NodeCoords, NodeConn[, ElemType])

Returns edges grouped by the element from which they came.

faces2surface(Faces[, return_ids])

Identify surface elements, i.e. faces that aren't shared between two elements.

faces2unique(Faces[, return_idx, return_inv])

Reduce set of mesh faces to contain only unique faces, i.e. there will only be one entry to indicate a face shared between two elements.

edges2unique(Edges[, return_idx, ...])

Reduce set of mesh edges to contain only unique edges, i.e. there will only be one entry to indicate a edge shared between multiple elements.

tet2faces(NodeCoords, NodeConn)

Extract triangular faces from all elements of a purely 4-Node tetrahedral mesh.

hex2faces(NodeCoords, NodeConn)

Extract quadrilateral faces from all elements of a purely 8-Node hexahedral mesh.

pyramid2faces(NodeCoords, NodeConn)

Extract triangular and quadrilateral faces from all elements of a purely 5-Node pyramidal mesh.

wedge2faces(NodeCoords, NodeConn)

Extract triangular and quadrilateral faces from all elements of a purely 6-Node wedge elemet mesh.

tri2edges(NodeCoords, NodeConn)

Extract edges from all elements of a purely 3-Node triangular mesh.

quad2edges(NodeCoords, NodeConn)

Extract edges from all elements of a purely 4-Node quadrilateral mesh.

polygon2edges(NodeCoords, NodeConn)

Extract edges from all elements of a polygonal mesh.

tet2edges(NodeCoords, NodeConn)

Extract edges from all elements of a purely 4-Node tetrahedral mesh.

pyramid2edges(NodeCoords, NodeConn)

Extract edges from all elements of a purely 5-Node pyramidal mesh.

wedge2edges(NodeCoords, NodeConn)

Extract edges from all elements of a purely 6-Node wedge element mesh.

hex2edges(NodeCoords, NodeConn)

Extract edges from all elements of a purely 8-Node hexahedral mesh.

Element type conversion#

solid2tets(NodeCoords, NodeConn[, ...])

Decompose all elements of a 3D volume mesh to tetrahedra.

surf2tris(NodeCoords, NodeConn[, ...])

Decompose all elements of a surface mesh to triangles.

linear2quadratic(NodeCoords, NodeConn[, Type])

Convert linear (first-order) elements to quadratic (second-order) elements.

quadratic2linear(NodeCoords, NodeConn[, cleanup])

Convert quadratic (second-order) elements to linear (first-order) elements.

hex2tet(NodeCoords, NodeConn[, method])

Decompose all elements of a 3D hexahedral mesh to tetrahedra.

wedge2tet(NodeCoords, NodeConn[, method])

Decompose all elements of a 3D wedge-element mesh to tetrahedra.

pyramid2tet(NodeCoords, NodeConn[, method])

Decompose all elements of a 3D pyramidal mesh to tetrahedra.

quad2tri(NodeCoords, NodeConn)

Converts a quadrilateral mesh to a triangular mesh by splitting each quad into 2 tris

edge32linear(NodeCoords, NodeConn)

Converts a 3-node edge mesh to a 2-node edge mesh.

edge2quadratic(NodeCoords, NodeConn[, cleanup])

Converts a 2 node edge mesh to 3 node edge mesh.

tri62linear(NodeCoords, NodeConn)

Converts a 6-node triangular mesh to a 3-node triangular mesh.

tri2quadratic(NodeCoords, NodeConn[, cleanup])

Converts a 3 node triangular mesh to 6 node triangular mesh.

quad82linear(NodeCoords, NodeConn)

Converts a 8-node quadrilateral mesh to a 4-node quadrilateral mesh.

quad2quadratic(NodeCoords, NodeConn[, cleanup])

Converts a 4 node quadrilateral mesh to 8 node quadrilateral mesh.

tet102linear(NodeCoords, Tet10NodeConn)

Converts a 10-node tetradehdral mesh to a 4-node tetradehedral mesh.

tet2quadratic(NodeCoords, Tet4NodeConn[, ...])

Converts a 4 node tetrahedral mesh to 10 node tetrahedral mesh.

pyr132linear(NodeCoords, NodeConn)

Converts a 13-node pyramid mesh to a 5-node pyramid mesh.

pyr2quadratic(NodeCoords, NodeConn[, cleanup])

Converts a 5 node pyramid mesh to 13 node pyramid mesh.

wdg152linear(NodeCoords, NodeConn)

Converts a 15-node wedge mesh to a 6-node wedge mesh.

wdg2quadratic(NodeCoords, NodeConn[, cleanup])

Converts a 6 node wedge mesh to 15 node wedge mesh.

hex202linear(NodeCoords, Hex20NodeConn)

Converts a 20-node hexahedral mesh to an 8-node hexahedral mesh.

hex2quadratic(NodeCoords, Hex8NodeConn[, ...])

Converts a 4 node tetrahedral mesh to 10 node tetrahedral mesh.

hexsubdivide(NodeCoords, NodeConn)

Subdivide hexahedra into 8 sub-hexahedra, connecting corners to the element, face, and edge centroids.

tetsubdivide(NodeCoords, NodeConn[, method])

Subdivide tetrahedra into sub-tetrahedra.