fovi.sensing.mesh_geodesic
Exact geodesic distances on triangle meshes, solved in batches with Warp.
Distances are measured on the piecewise-linear surface itself, not along mesh
edges. The solver follows the window-propagation scheme of Chen and Han (1990)
with the vertex-distance filtering and priority ordering of Xin and Wang’s
“Improved Chen-Han” algorithm (2009), the same exact problem that
Mitchell-Mount-Papadimitriou solvers such as pygeodesic answer.
A window is an interval of a mesh edge whose shortest paths all unfold to straight lines from one (pseudo-)source. Windows cross faces in order of their nearest distance, and each crossing unfolds the next face into the plane of the current one. Paths that bend around a saddle or boundary vertex continue from that vertex as a new pseudo-source. A window is discarded only when one of its edge’s endpoint vertices already reaches every point of the window by a strictly shorter path, so no shortest path is lost.
Each single-source solve is one Warp thread, in float64, with its own distance array and window heap. A batch of solves, such as one per source on a shared mesh or one per local mesh of a KNN layer, runs as one CUDA launch, or as concurrent launches on Warp’s CPU backend, one per core. Each solve is serial, so CUDA pays off for many small meshes; a few solves on a large mesh run faster on the CPU.
- class fovi.sensing.mesh_geodesic.ExactGeodesicSolver(vertices, faces, device=None)[source]
Bases:
objectExact surface geodesic distances from vertices of one triangle mesh.
- Parameters:
vertices –
(V, 3)or(V, 2)vertex positions; planar input lies inz = 0.faces –
(F, 3)vertex indices of the triangles. The mesh must be an edge-manifold (each edge borders at most two faces) of non-degenerate triangles. Vertices not referenced by any face are unreachable.device – Warp device for the solves; CPU by default, which suits a few solves on a large mesh.
- fovi.sensing.mesh_geodesic.SOLVER_VERSION = 'fovi-ich-1'
Identifies this solver in persistent caches of its results.
- fovi.sensing.mesh_geodesic.distances_from_first_vertex(meshes: Sequence[tuple[ndarray, ndarray]], device=None) list[ndarray][source]
Distances from vertex 0 of each of many small meshes, solved in one batch.
- Parameters:
meshes –
(vertices, faces)pairs, as forExactGeodesicSolver.device – Warp device; CPU by default.
- Returns:
One
(V_i,)float64 array per mesh.