Find nearest mesh vertex for query coordinates using kdtree.
Usage
find_nv_kdtree(query_coordinates, mesh, threads = parallel::detectCores())Arguments
- query_coordinates
nx3 numerical matrix of x,y,z coordinates. These are typically the vertex positions of a second (spherical!) mesh for that you need per-vertex data (e.g., the
fsaverage6mesh).- mesh
fs.surface instance, see
read.fs.surfaceorsubject.surfaceto get one, or turn anrgltmeshinto one withtmesh3d.to.fs.surface.- threads
integer, the number of threads to run in parallel.
Value
named list with keys 'index' and 'distance'. 'index': integer vector, the n vertex indices which are closest to the nx3 matrix of query_coordinates. 1-based indices for R are returned. 'distance': double vector, the distances to the respective vertices in the 'index' key.