Skip to content

Instantly share code, notes, and snippets.

@rukku
Created February 8, 2012 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rukku/1767181 to your computer and use it in GitHub Desktop.
Save rukku/1767181 to your computer and use it in GitHub Desktop.
Finds nearest neighbor between point patterns using FNN
#Get second nearest neighbors using knnx
x1 <- cbind(ponderosa$x, ponderosa$y)
x2 <- cbind(rp$x, rp$y)
nn2 <- get.knnx(x1, x2, 2)
X.2 <- nn2$nn.dist[,2]
X.22 <- X.2^2
sumX.22 <- sum(X.22)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment