View source: R/surf_shortestPath.R
sPathConnect | R Documentation |
Projects the given set of ordered coordinates onto the mesh and connects them following the shortest path (weighted or unweighted) along triangle edges (i.e. connected vertices) on a target mesh. The curve described by the coordinates may be open or closed.
sPathConnect(coords, mesh, path.choice = "any", closed = FALSE)
coords |
data.frame-like object of ordered 3D coordinates (one per row). Only first three columns will be evaluated. |
mesh |
a mesh3d object. Please ensure it is uniformly sampled. |
path.choice |
path choice specification. Options are the same as for the sPathQuery function. |
closed |
boolean describing whether the path forms a closed loop or is open. This option is ignored if the starting coordinate is the same as the end coordinate (i.e. the path is already closed). |
A numeric, ordered list of all vertex IDs in the path (includes start and end vertices)
The performance of this function is highly dependent on the degree to which the mesh is uniformly sampled. Please consider remeshing before running this function. The following example assumes your mesh is called ply:
ply <- vcgUniformRemesh(ply, voxelSize=median(vcgMeshres(ply)$edgelength))
Note also that, internally, this function uses sPathQuerry and mapOnMesh, so note that the input coordinates are not mapped onto the closest surface point, but to the nearest mesh vertex. This may lead to small discrepancies with input landmarks that are already mapped onto the mesh surface. See mapOnMesh documentation for more information.
Finally, note that this function can return duplicated vertex ID sequences (i.e. path tracks back on itself near input coordinates), which may cause problems with, for example, geomorph::digit.curves
sPathQuery
# TODO!
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.