inout {spgam}R Documentation

~~function to do ... ~~

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

inout(pts, poly, bound = NULL, quiet = TRUE)

Arguments

pts ~~Describe pts here~~
poly ~~Describe poly here~~
bound ~~Describe bound here~~
quiet ~~Describe quiet here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1 Description of 'comp1'
comp2 Description of 'comp2'

...

Warning

....

Note

~~further notes~~

~Make other sections like Warning with section{Warning }{....} ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

##---- 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
  }

[Package spgam version 1.0 Index]