Mesh Data Structure¶

class
pymesh.
Mesh
(raw_mesh)¶ A generic representation of a surface or volume mesh.

vertices
¶ A \((N_v \times D)\) array of vertex coordinates, where \(N_v\) is the number of vertices, \(D\) is the dimention of the embedding space (\(D\) must be either 2 or 3).

faces
¶ A \((N_f \times F_d)\) array of vertex indices that represents a generalized array of faces, where \(N_f\) is the number of faces, \(F_d\) is the number of vertex per face. Only triangles (\(F_d=3\)) and quad (\(F_d=4\)) faces are supported.

voxels
¶ A \((N_V \times V_d)\) array of vertex indices that represents an array of generalized voxels, where \(N_V\) is the number of voxels, \(V_d\) is the number of vertex per voxel. Only tetrahedron (\(V_d=4\)) and hexahedron (\(V_d=8\)) are supported for now.

num_vertices
¶ Number of vertices (\(N_v\)).

num_faces
¶ Number of faces (\(N_f\)).

num_voxels
¶ Number of voxels (\(N_V\)).

dim
¶ Dimention of the embedding space (\(D\)).

vertex_per_face
¶ Number of vertices in each face (\(F_d\)).

vertex_per_voxel
¶ Number of vertices in each voxel (\(V_d\)).

attribute_names
¶ Names of all attribute associated with this mesh.

bbox
¶ A \((2 \times D)\) array where the first row is the minimum values of each vertex coordinates, and the second row is the maximum values.

num_nodes
¶ Number of nodes.

num_elements
¶ Number of elements.

nodes_per_element
¶ Number of nodes in each element.

element_volumes
¶ An array representing volumes of each element.

num_components
¶ Number of vertexconnected_components.

num_surface_components
¶ Number of edgeconnected components.

num_volume_components
¶ Number of faceconnected components.

add_attribute
(name)¶ Add an attribute to mesh.

has_attribute
(name)¶ Check if an attribute exists.

get_attribute
(name)¶ Return attribute values in a flattened array.

get_vertex_attribute
(name)¶ Same as
get_attribute()
but reshaped to havenum_vertices
rows.

get_face_attribute
(name)¶ Same as
get_attribute()
but reshaped to havenum_faces
rows.

get_voxel_attribute
(name)¶ Same as
get_attribute()
but reshaped to havenum_voxels
rows.

set_attribute
(name, val)¶ Set attribute to the given value.

remove_attribute
(name)¶ Remove attribute from mesh.

get_attribute_names
()¶ Get names of all attributes associated with this mesh.

is_manifold
()¶ Return true iff this mesh is both vertexmanifold and edgemanifold.

is_vertex_manifold
()¶ Return true iff this mesh is vertexmanifold.
A mesh is vertexmanifold if the 1ring neighborhood of each vertex is a topological disk.

is_edge_manifold
()¶ Return true iff this mesh is edgemanifold.
A mesh is edgemanifold if there are exactly 2 incident faces for all nonborder edges. Border edges, by definition, only have 1 incident face.

is_closed
()¶ Return true iff this mesh is closed.
A closed mesh constains no border. I.e. all edges have at least 2 incident faces.

is_oriented
()¶ Return true iff the mesh is consistently oriented.
That is all nonbonary edges must represent locally 2manifold or intersection of 2manifold surfaces.
