vcgDijkstra: Compute pseudo-geodesic distances on a triangular mesh

View source: R/vcgDijkstra.r

vcgDijkstraR Documentation

Compute pseudo-geodesic distances on a triangular mesh

Description

Compute pseudo-geodesic distances on a triangular mesh

Usage

vcgDijkstra(x, vertpointer, maxdist = NULL)

Arguments

x

triangular mesh of class mesh3d

vertpointer

integer: references indices of vertices on the mesh, typically only a single query vertex.

maxdist

positive scalar double, the maximal distance to travel along the mesh when computing distances. Leave at NULL to traverse the full mesh. This can be used to speed up the computation if you are only interested in geodesic distances to neighbors within a limited distance around the query vertices.

Value

returns a vector of shortest distances for each of the vertices to one of the vertices referenced in vertpointer. If maxdist is in use (not NULL), the distance values for vertices outside the requested maxdist are not computed and appear as 0.

Note

Make sure to have a clean manifold mesh. Note that this computes the length of the pseudo-geodesic path (following the edges) between the two vertices.

Examples

## Compute geodesic distance between all mesh vertices and the first vertex of a mesh
data(humface)
geo <- vcgDijkstra(humface,1)
if (interactive()) {
require(Morpho);require(rgl)
meshDist(humface,distvec = geo)
spheres3d(vert2points(humface)[1,],col=2)
}

Rvcg documentation built on Feb. 16, 2023, 5:12 p.m.