R/areapoly.R

## area of a polygon
## "." in name string may be confused with class method???
areapoly <- function(poly) {
    npoly <- nrow(poly)
    asign <- 1
    ans <- .C("area_poly", as.double(poly), as.integer(npoly),
              area=as.double(0), PACKAGE="spatialkernel")$area
    if(ans < 0) {
        asign <- -1
        ans <- -ans
    }
    invisible(list(area=ans, sign=asign, poly=poly))
}

Try the spatialkernel package in your browser

Any scripts or data that you put into this service are public.

spatialkernel documentation built on May 2, 2019, 4:37 p.m.