Learn R Programming

Morpho (version 2.1)

mcNNindex: find nearest neighbours for point clouds

Description

find nearest neighbours for point clouds by using algorithms from the ANN library. This is just a wrapper for the function ann from the package yaImpute, enabling parallel processing.

Usage

mcNNindex(target, query, cores = parallel::detectCores(), k = k, ...)

Arguments

target
k x m matrix containing data which to search.
query
l x m matrix containing data for which to search.
cores
integer: amount of CPU-cores to be used. Speed benefits are only relevant for k > 20
k
integer: how many closest points are sought.
...
additional arguments - currently unused.

Value

  • l x k matrix containing indices of closest points.

Details

wraps the function ann from package 'yaImpute' to allow multicore processing

See Also

closemeshKD

Examples

Run this code
require(rgl)
data(nose)
# find closest vertex on surface for each landmark
clost <- mcNNindex(vert2points(shortnose.mesh),shortnose.lm, k=1,
mc.cores=1)
spheres3d(vert2points(shortnose.mesh)[clost,],col=2,radius=0.3)
spheres3d(shortnose.lm,radius=0.3)
wire3d(shortnose.mesh)

Run the code above in your browser using DataLab