inout {spgam} | R Documentation |
~~ A concise (1-5 lines) description of what the function does. ~~
inout(pts, poly, bound = NULL, quiet = TRUE)
pts |
~~Describe pts here~~ |
poly |
~~Describe poly here~~ |
bound |
~~Describe bound here~~ |
quiet |
~~Describe quiet here~~ |
~~ If necessary, more details than the description above ~~
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
....
~~further notes~~
~Make other sections like Warning with section{Warning }{....} ~
~~who you are~~
~put references to the literature/web site here ~
~~objects to See Also as help
, ~~~
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as function (pts, poly, bound = NULL, quiet=TRUE) { xp <- c(poly[, 1], poly[1, 1]) yp <- c(poly[, 2], poly[1, 2]) np <- length(xp) nptsi <- npts(pts) ind <- logical(length = nptsi) if (!is.null(bound)) { # # sets in-polygon criterion for points equal to polygon # boundaries (suggestion by Rainer Hurling <rhurlin@gwdg.de>) # if (!is.logical(bound)) stop("bound must be NULL, TRUE, or FALSE") result <- integer(length=nptsi) bb <- as.vector(apply(sbox(as.points(xp, yp)), 2, range)) za <- .C("ptinpoly1", as.integer(result), as.double(pts[, 1]), as.double(pts[, 2]), as.double(xp), as.double(yp), as.integer(np), as.double(bb), as.integer(nptsi), PACKAGE="spgam") z <- ind if (!quiet) { bpts <- which(za[[1]] == 0) if (length(bpts > 0)) { cat("Points on boundary:\n") print(bpts) } else cat("No points on boundary\n") } if(bound) z[which(za[[1]] <= 0)] <- TRUE else z[which(za[[1]] < 0)] <- TRUE } else { piplist <- .Fortran("inpip", as.double(pts[, 1]), as.double(pts[,2]), as.integer(nptsi), as.double(xp), as.double(yp), as.integer(np), as.logical(ind), PACKAGE="spgam") z <- piplist[[7]] } z }