spateo.tdr.models.models_individual.mesh_utils#

This code contains methods to optimize the final reconstructed mesh model.
  1. uniform mesh

  2. fix mesh

Module Contents#

Functions#

uniform_larger_pc(→ pyvista.PolyData)

Generates a uniform point cloud with a larger number of points.

uniform_mesh(→ pyvista.PolyData)

Generate a uniformly meshed surface using voronoi clustering.

smooth_mesh(→ pyvista.PolyData)

Adjust point coordinates using Laplacian smoothing.

fix_mesh(→ pyvista.PolyData)

Repair the mesh where it was extracted and subtle holes along complex parts of the mesh.

clean_mesh(→ pyvista.PolyData)

Removes unused points and degenerate cells.

spateo.tdr.models.models_individual.mesh_utils.uniform_larger_pc(pc: pyvista.PolyData, alpha: float | int = 0, nsub: int | None = 5, nclus: int = 20000) pyvista.PolyData[source]#

Generates a uniform point cloud with a larger number of points. If the number of points in the original point cloud is too small or the distribution of the original point cloud is not uniform, making it difficult to construct the surface, this method can be used for preprocessing.

Parameters:
pc

A point cloud model.

alpha

Specify alpha (or distance) value to control output of this filter. For a non-zero alpha value, only edges or triangles contained within a sphere centered at mesh vertices will be output. Otherwise, only triangles will be output.

nsub

Number of subdivisions. Each subdivision creates 4 new triangles, so the number of resulting triangles is nface*4**nsub where nface is the current number of faces.

nclus

Number of voronoi clustering.

Returns:

A uniform point cloud with a larger number of points.

Return type:

new_pc

spateo.tdr.models.models_individual.mesh_utils.uniform_mesh(mesh: pyvista.PolyData, nsub: int | None = 3, nclus: int = 20000) pyvista.PolyData[source]#

Generate a uniformly meshed surface using voronoi clustering.

Parameters:
mesh

A mesh model.

nsub

Number of subdivisions. Each subdivision creates 4 new triangles, so the number of resulting triangles is nface*4**nsub where nface is the current number of faces.

nclus

Number of voronoi clustering.

Returns:

A uniform mesh model.

Return type:

new_mesh

spateo.tdr.models.models_individual.mesh_utils.smooth_mesh(mesh: pyvista.PolyData, n_iter: int = 100, **kwargs) pyvista.PolyData[source]#

Adjust point coordinates using Laplacian smoothing. https://docs.pyvista.org/api/core/_autosummary/pyvista.PolyData.smooth.html#pyvista.PolyData.smooth

Parameters:
mesh

A mesh model.

n_iter

Number of iterations for Laplacian smoothing.

**kwargs

The rest of the parameters in pyvista.PolyData.smooth.

Returns:

A smoothed mesh model.

Return type:

smoothed_mesh

spateo.tdr.models.models_individual.mesh_utils.fix_mesh(mesh: pyvista.PolyData) pyvista.PolyData[source]#

Repair the mesh where it was extracted and subtle holes along complex parts of the mesh.

spateo.tdr.models.models_individual.mesh_utils.clean_mesh(mesh: pyvista.PolyData) pyvista.PolyData[source]#

Removes unused points and degenerate cells.