geomfum.metric package#
Submodules#
geomfum.metric.mesh module#
Module containing metrics to calcualte distances on a mesh.
- class geomfum.metric.mesh.FinitePointSetMetric(shape)[source]#
-
Metric on a finite set of indexed points.
- abstract dist_from_source(source_point)[source]#
Distance from source point.
- Parameters:
source_point (array-like, shape=[…]) – Index of source point.
- Returns:
dist (array-like, shape=[…] or list-like[array-like]) – Distance.
target_point (array-like, shape=[n_targets] or list-like[array-like]) – Target index.
- class geomfum.metric.mesh.GraphShortestPathMetric(shape, cutoff=None)[source]#
Bases:
_NxDijkstraMixins
,FinitePointSetMetric
Shortest path on edge graph of mesh with single source Dijkstra.
- Parameters:
shape (Shape) – Shape.
cutoff (float) – Length (sum of edge weights) at which the search is stopped.
- class geomfum.metric.mesh.HeatDistanceMetric(*args, **kwargs)[source]#
Bases:
WhichRegistryMixins
Heat distance metric between vertices of a mesh.
References
[CWW2013]Crane, K., Weischedel, C., Wardetzky, M., 2017. The heat method for distance computation. Commun. ACM 60, 90–99. https://doi.org/10.1145/3131280
- class geomfum.metric.mesh.KClosestGraphShortestPathMetric(shape, k_closest=5)[source]#
Bases:
_NxDijkstraMixins
,FinitePointSetMetric
Shortest path on edge graph of mesh with Dijkstra.
- Parameters:
shape (Shape) – Shape.
k_closest (int) – Number of nodes to find distances to (including the source itself).
- class geomfum.metric.mesh.Metric(shape)[source]#
Bases:
ABC
Metric.
- Parameters:
shape (Shape) – Considered as a manifold.
- class geomfum.metric.mesh.ScipyGraphShortestPathMetric(shape, cutoff=None)[source]#
Bases:
_ScipyShortestPathMixins
,FinitePointSetMetric
Shortest path on edge graph of mesh with Scipy shortest path solver.
- Parameters:
shape (Shape) – Shape.
cutoff (float) – Length (sum of edge weights) at which the search is stopped.
- class geomfum.metric.mesh.VertexEuclideanMetric(shape)[source]#
Bases:
FinitePointSetMetric
Euclidean metric between vertices of a mesh.
- dist(point_a, point_b)[source]#
Distance between mesh vertices.
- Parameters:
point_a (array-like, shape=[…]) – Index of source point.
point_b (array-like, shape=[…]) – Index of target point.
- Returns:
dist (array-like, shape=[…]) – Distance.
- dist_from_source(source_point)[source]#
Distance from source point.
- Parameters:
source_point (array-like, shape=[…]) – Index of source point.
- Returns:
dist (array-like, shape=[…] or array-like[array-like]) – Distance.
target_point (array-like, shape=[n_targets] or array-like[array-like]) – Target index.