mcNNindex: find nearest neighbours for 2D and 3D point clouds

View source: R/mcNNindex.r

mcNNindexR Documentation

find nearest neighbours for 2D and 3D point clouds

Description

find nearest neighbours for point clouds using a kd-tree search. This is just a wrapper of the function vcgKDtree from package Rvcg. Wwraps the function vcgKDtree from package 'Rvcg' (for backward compatibility )

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. Only available on systems with OpenMP support.

k

integer: how many closest points are sought.

...

additional arguments - currently unused.

Value

l x k matrix containing indices of closest points.

See Also

closemeshKD

Examples


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

## End(Not run)

zarquon42b/Morpho documentation built on Jan. 28, 2024, 2:11 p.m.