lapy.shapedna¶
Functions for computing and comparing Laplace spectra.
Includes code for solving the anisotropic Laplace-Beltrami eigenvalue problem as well as functions for normalization and comparison of Laplace spectra.
- lapy.shapedna.compute_distance(ev1, ev2, dist='euc')¶
Compute the shape dissimilarity from two shapeDNA descriptors.
- Parameters:
- ev1array_like
First set of sorted eigenvalues.
- ev2array_like
Second set of sorted eigenvalues.
- dist
str
Distance measure; currently only ‘euc’ (Euclidean).
- Returns:
- *
float
Distance between the eigenvalue arrays.
- *
- lapy.shapedna.compute_shapedna(geom, k=50, lump=False, aniso=None, aniso_smooth=10, use_cholmod=False)¶
Compute the shapeDNA descriptor for triangle or tetrahedral meshes.
- Parameters:
- geom
TriaMesh
orTetMesh
Mesh geometry.
- k
int
, default=50 Number of eigenfunctions / eigenvalues.
- lump
bool
, default=False - If True, lump the mass matrix (diagonal).
(See ‘lapy.Solver.Solver’ class).
- aniso
float
ortuple
of shape (2,) - Anisotropy for curvature based anisotopic Laplace.
(See ‘lapy.Solver.Solver’ class).
- aniso_smooth
int
- Number of smoothing iterations for curvature computation on vertices.
(See ‘lapy.Solver.Solver’ class).
- use_cholmod
bool
, default:False
If True, attempts to use the Cholesky decomposition for improved execution speed. Requires the
scikit-sparse
library. If it can not be found, an error will be thrown. If False, will use slower LU decomposition.
- geom
- Returns:
- ev
dict
A dictionary, including ‘Eigenvalues’ and ‘Eigenvectors’ fields.
- ev
- lapy.shapedna.normalize_ev(geom, evals, method='geometry')¶
Normalize a surface or a volume.
- Parameters:
- geom
TriaMesh
orTetMesh
Mesh geometry.
- evalsarray_like
Set of sorted eigenvalues.
- method
str
Either “surface”, “volume”, or “geometry”; “geometry” will perform surface normalization for 2D objects, and volume normalization for 3D objects.
- geom
- Returns:
- array_like
Vector of re-weighted eigenvalues.
- lapy.shapedna.reweight_ev(evals)¶
Apply linear re-weighting.
- Parameters:
- evalsarray_like
Set of sorted eigenvalues.
- Returns:
- evals: array_like
Vector of re-weighted eigenvalues.