pymeshfix.PyTMesh#

class pymeshfix.PyTMesh#

Cython class to interface with C++ Basic_TMesh object

MeshFix V2.0 - by Marco Attene If MeshFix is used for research purposes, please cite the following paper:

M. Attene. A lightweight approach to repairing digitized polygon meshes. The Visual Computer, 2010. (c) Springer.

Examples

Create an instance of TMesh

>>> from pymeshfix import _meshfix
>>> tin = _meshfix.PyTMesh()

Load a file

>>> tin.LoadFile(infile)

Load from arrays

>>> tin.load_array(v, f)

Attempt to join nearby components

>>> tin.join_closest_components()

Fill holes

>>> tin.fill_small_boundaries()
>>> print('There are {:d} boundaries'.format(tin.boundaries())

Clean and remove self intersections

>>> tin.clean(max_iters=10, inner_loops=3)

Check mesh for holes again

>>> print('There are {:d} boundaries'.format(tin.boundaries())

Output mesh

>>> tin.save_file(outfile)

return numpy arrays

>>> vclean, fclean = tin.return_arrays()

Methods

PyTMesh.boundaries

Get the number of boundary loops of the triangle mesh

PyTMesh.clean

Remove self-intersections and degenerate faces.

PyTMesh.fill_small_boundaries

Fill small boundaries.

PyTMesh.join_closest_components

Attempt to join nearby open components.

PyTMesh.load_array

Load points from numpy vertices and faces arrays.

PyTMesh.load_file

Loads mesh from file

PyTMesh.remove_smallest_components

Remove smallest components

PyTMesh.return_arrays

Return vertex and face arrays of the mesh.

PyTMesh.save_file

Save cleaned mesh to file

PyTMesh.select_intersecting_triangles

Selects all intersecting triangles.

Attributes

PyTMesh.n_points

Number of points in the mesh