Mesh

class m3sh.hds.Mesh(points=None, faces=None)[source]

Mesh kernel.

The combinatorics of a mesh can be built by reading from a file or by converting a sequence of vertex coordinates and a sequence of face definitions to its halfedge representation.

Parameters:
  • points (array_like, optional) – Vertex coordinates. Converted to an equivalent ndarray object if necessary.

  • faces (array_like, optional) – Face definitions, 0-based vertex indexing.

Raises:

NonManifoldError – When trying to initialize a mesh from non-manifold data.

Note

The NumPy glossary states the following about array_like data representations:

Any scalar or sequence that can be interpreted as numpy.ndarray. In addition to ndarrays and scalars this category includes lists (possibly nested and with different element types) and tuples. Any argument accepted by numpy.array() is array_like.

Attributes

faces

Face list.

halfedges

Halfedge dictionary.

points

Vertex coordinate array.

size

Mesh size.

vertices

Vertex list.

Methods

add_face(face, *args, **kwargs)

Create and add new face.

add_face_data(name, attr, data[, default])

Add face data.

add_halfedge_data(name, attr, data[, default])

Add halfedge data.

add_vertex(point, *args, **kwargs)

Create and add new vertex.

add_vertex_data(name, attr, data[, default])

Add vertex data.

clean()

Garbage collection.

clear()

Clear all mesh items.

clone(mesh)

In-place mesh copy.

collapse_halfedge(halfedge[, point, ...])

Perform edge collapse.

copy()

Return mesh copy.

delete_face(face[, del_isolated_verts])

Delete face.

delete_halfedge(halfedge[, del_isolated_verts])

Merge adjacent faces.

delete_vertex(vertex[, fill])

Delete vertex.

flip_halfedge(halfedge, *[, check])

Flip halfedge.

insert_halfedge(face, origin, target)

Insert face diagonal.

read(filename, *args[, merge, quiet])

Read mesh from file.

split_halfedge(halfedge[, point, triangulate])

Split halfedge.

write(filename[, quiet])

Write mesh to file.

Special methods

__getitem__(index)

__iter__()

Face iterator.