nearest_neighbour_interpolation: Function for nearest neighbour interpolation

Description Usage Arguments Value Examples

View source: R/unstructured_interpolation.R

Description

Basically a wrapper around the SearchTrees package

Usage

1

Arguments

xy

= points locations associated with values to interpolation from (typically nx2 matrix)

vals

= values at xy (can be a matix with 1 or more colums, and the same number of rows as xy)

newPts

= points where we want interpolated values (typically mx2 matrix)

Value

matrix/vector with as many columns as 'vals' and as many rows as 'newPts', containing the 'vals' interpolated to 'newPts'

Examples

1
2
3
4
5
6
7
# Make a single triangle in the plane z=x+y, and interpolate from it
   xy=matrix(c(0,0,0,1,1,1),ncol=2,byrow=TRUE)
   vals=c(0, 1, 2) # z=x+y
   newPts=matrix(c(0.1, 0.9, 0.9, 0.9), ncol=2, byrow=TRUE)

   out=nearest_neighbour_interpolation(xy, vals, newPts)
   stopifnot(all.equal(out, c(1,2)))

GeoscienceAustralia/unstructInterp documentation built on Nov. 18, 2017, 6:50 a.m.