Remeshing#

Uniform remeshing via the ACVD (Approximate Centroidal Voronoi Diagram) clustering algorithm. Given a target number of clusters, the algorithm redistributes mesh vertices to produce a more uniform cell distribution.

The approach is dimension-agnostic and works for any simplicial manifold:

  1. Weight vertices by incident cell areas

  2. Initialize clusters via area-based region growing

  3. Remove spatially isolated cluster regions

  4. Reconstruct a simplified mesh from cluster adjacency

Note

The output mesh may contain a small percentage (~0.5-1%) of non-manifold edges, which is inherent to the face-mapping approach. Higher cluster counts relative to mesh resolution produce better manifold quality.

from physicsnemo.mesh.remeshing import remesh
from physicsnemo.mesh.primitives.surfaces import sphere_icosahedral

mesh = sphere_icosahedral.load(subdivisions=3)
remeshed = remesh(mesh, n_clusters=100)
print(remeshed.n_cells)  # approximately 200 triangles

API Reference#

Uniform mesh remeshing via clustering.

This module provides dimension-agnostic uniform remeshing based on the ACVD (Approximate Centroidal Voronoi Diagram) clustering algorithm. It works for arbitrary n-dimensional simplicial manifolds.

The algorithm: 1. Weights vertices by incident cell areas 2. Initializes clusters via area-based region growing 3. Removes spatially isolated cluster regions 4. Reconstructs a simplified mesh from cluster adjacency

The output mesh has approximately uniform cell distribution with ~0.5% non-manifold edges (multiple faces sharing an edge), which is inherent to the face-mapping approach.

Current limitations: - Energy minimization is disabled (made topology worse; needs investigation) - Small percentage (~0.5-1%) of edges may be non-manifold with moderate cluster counts - Higher cluster counts relative to mesh resolution produce better manifold quality

Example

>>> from physicsnemo.mesh.primitives.surfaces import sphere_icosahedral
>>> mesh = sphere_icosahedral.load(subdivisions=3)
>>> # Remesh a triangle mesh to ~100 triangles
>>> remeshed = remesh(mesh, n_clusters=100)
>>> assert remeshed.n_cells > 0