For each point in the given three-dimensional
point pattern, this function finds
its nearest neighbour (the nearest other point of the pattern).
By default it returns a vector giving, for each point,
the index of the point's
nearest neighbour. If k
is specified, the algorithm finds
each point's k
th nearest neighbour.
The function nnwhich
is generic. This is the method
for the class "pp3"
.
If there are no points in the pattern,
a numeric vector of length zero is returned.
If there is only one point,
then the nearest neighbour is undefined, and a value of NA
is returned. In general if the number of points is less than or equal
to k
, then a vector of NA
's is returned.
To evaluate the distance between a point and its nearest
neighbour, use nndist
.
To find the nearest neighbours from one point pattern
to another point pattern, use nncross
.