RHM.geometry_utils¶
Functions
|
Compute embedding of a mesh using MDS |
|
Runs quadratic mesh decimation on a mesh |
|
Query nearest neighbors. |
- RHM.geometry_utils.knn_query(X, Y, k=1, return_distance=False, n_jobs=1)¶
Query nearest neighbors.
- Parameters:
X ((n,d) np.ndarray) – Dataset
Y ((m,d) np.ndarray) – Query points
k (int) – Number of neighbors to return
return_distance (bool) – Whether to return distances
n_jobs (int) – Number of jobs to run in parallel
- Returns:
dists ((m,k) np.ndarray, optional) – Distances to the k nearest neighbors. Only returned if return_distance is True
matches ((m,k) np.ndarray) – Indices of the k nearest neighbors
- RHM.geometry_utils.decimate(mesh1, n_target_faces, n_jobs=1)¶
Runs quadratic mesh decimation on a mesh
- Parameters:
mesh1 (TriMesh object) – input mesh
n_target_faces (int) – number of faces in the output mesh
n_jobs (int) – number of jobs to run in parallel for NN query
- Returns:
sub_indices – Indices of the vertices in the decimated mesh
- Return type:
(m,) np.ndarray
- RHM.geometry_utils.compute_embedding(mesh1, n_samples=500, n_components=8, n_jobs=1)¶
Compute embedding of a mesh using MDS
The embedding mimics the geodesic distances of the mesh
- Parameters:
mesh1 (TriMesh object) – input mesh
n_samples (int) – number of samples to use for the embedding
n_components (int) – number of components of the embedding
n_jobs (int) – number of jobs to run in parallel for MDS
- Returns:
emb_final – Embedding of the mesh
- Return type:
(n,d) np.ndarray