vcgDijkstra {Rvcg} | R 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 |
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 |
Value
returns a vector of shortest distances for each of the vertices to one of the vertices referenced in vertpointer
. If maxdis
t 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)
}