m3sh.hds.

Mesh#

class Mesh(points=None, faces=None, *, name=None)#

Mesh kernel.

A mesh can be built by converting a sequence of vertex coordinates and a sequence of face definitions to its halfedge representation.

Parameters:
pointsarray_like, optional

Vertex coordinates. Converted to equivalent ndarray instance if not already of this type. In the latter case the mesh uses the points array directly without making a copy.

faceslist[list[int]], optional

Face definitions, 0-based vertex indexing. The faces list itself is not stored or modified but converted to an equivalent list of Face instances that is accessible via the faces attribute of a mesh.

namestr, optional

Name tag. Defaults to the string ‘None’ if not specified. Can be queried and changed later using the name property.

See also

from_OBJ

Read from Wavefront OBJ file.

from_OFF

Read from OFF (Object File Format) file.

from_grid

Convert grid data to quadrilateral mesh.

Notes

If neither points nor faces is specified, an empty mesh is created. You may specify points and omit faces but not the other way around.

Attributes

faces

Face list.

halfedges

Halfedge dictionary.

name

Name property.

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.

boundaries([vertices, ccw])

Extract boundary components.

clean()

Garbage collection.

clear()

Clear all mesh items.

clone(mesh)

In-place mesh copy.

collapse_halfedge(halfedge[, point, pull])

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.

from_OBJ(filename, *args[, quiet])

Read mesh from Wavefront OBJ file.

from_OFF(filename, *args[, quiet])

Read from OFF file.

from_grid(array, *arrays[, triangulate, ...])

Construct mesh from grid data.

insert_halfedge(face, origin, target)

Insert face diagonal.

read(filename, *args[, quiet])

Read mesh from file.

split_halfedge(halfedge[, point, triangulate])

Split halfedge.

write(filename[, append, absolute, quiet])

Write mesh to file.