trimesh.remesh module

remesh.py

Deal with re- triangulation of existing meshes.

Functions

subdivide(vertices, faces[, face_index, …])

Subdivide a mesh into smaller triangles.

subdivide_to_size(vertices, faces, max_edge)

Subdivide a mesh until every edge is shorter than a specified length.

trimesh.remesh.subdivide(vertices, faces, face_index=None, vertex_attributes=None)

Subdivide a mesh into smaller triangles.

Note that if face_index is passed, only those faces will be subdivided and their neighbors won’t be modified making the mesh no longer “watertight.”

Parameters
  • vertices ((n, 3) float) – Vertices in space

  • faces ((m, 3) int) – Indexes of vertices which make up triangular faces

  • face_index (faces to subdivide.) – if None: all faces of mesh will be subdivided if (n,) int array of indices: only specified faces

  • vertex_attributes (dict) – Contains (n, d) attribute data

Returns

  • new_vertices ((q, 3) float) – Vertices in space

  • new_faces ((p, 3) int) – Remeshed faces

trimesh.remesh.subdivide_to_size(vertices, faces, max_edge, max_iter=10)

Subdivide a mesh until every edge is shorter than a specified length.

Will return a triangle soup, not a nicely structured mesh.

Parameters
  • vertices ((n, 3) float) – Vertices in space

  • faces ((m, 3) int) – Indices of vertices which make up triangles

  • max_edge (float) – Maximum length of any edge in the result

  • max_iter (int) – The maximum number of times to run subdivision

Returns

  • vertices ((j, 3) float) – Vertices in space

  • faces ((q, 3) int) – Indices of vertices