https://github.com/cran/fields
Raw File
Tip revision: 48e16d0f1496128e9d29d6f8819092244e94bef0 authored by Doug Nychka on 24 May 2001, 16:33:19 UTC
version 1.1
Tip revision: 48e16d0
in.poly.r
"in.poly" <-
function(xd, xp, convex.hull = F)
{
	if(!is.loaded(symbol.For("inpoly"))) {
		temp <- dyn.load(paste(FIELDS.BIN, "fields.o", sep = ""), 2)
	}
	if(convex.hull) {
		xp <- xp[chull(xp),  ]
	}
	nd <- nrow(xd)
	np <- as.integer(nrow(xp))
	.Fortran("inpoly",
		nd = as.integer(nd),
		as.single(xd[, 1]),
		as.single(xd[, 2]),
		np = np,
		as.single(xp[, 1]),
		as.single(xp[, 2]),
		ind = as.integer(rep(-1, nd)))$ind
}
back to top