[r-cran-polycub] 14/18: New upstream version 0.6.1

Andreas Tille tille at debian.org
Fri Oct 20 14:21:50 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-cran-polycub.

commit 3c848384568f182344fdab68f0b2316e98a9834a
Author: Andreas Tille <tille at debian.org>
Date:   Fri Oct 20 16:09:25 2017 +0200

    New upstream version 0.6.1
---
 DESCRIPTION                       | 14 ++++----
 MD5                               | 76 +++++++++++++++++++--------------------
 NAMESPACE                         | 18 +++-------
 R/circleCub.R                     | 15 ++++----
 R/coerce-gpc-methods.R            | 51 ++++++++++++--------------
 R/coerce-sp-methods.R             | 40 ++++++++++-----------
 R/plotpolyf.R                     | 15 ++++----
 R/polyCub.R                       | 11 +++---
 R/polyCub.SV.R                    | 42 +++++++++++-----------
 R/polyCub.exact.Gauss.R           | 44 +++++++++++------------
 R/polyCub.iso.R                   |  6 ++--
 R/polyCub.midpoint.R              | 24 ++++++-------
 R/tools.R                         | 23 ++++++------
 R/xylist.R                        | 20 +++++------
 R/zzz.R                           | 19 +++++-----
 README.md                         | 41 ++++++++++++++-------
 inst/NEWS.Rd                      | 20 +++++++++++
 inst/examples/plotpolyf.R         | 19 ++++++----
 inst/examples/polyCub.R           | 20 +++++------
 inst/examples/polyCub.iso.R       | 19 +++++-----
 inst/include/polyCubAPI.h         |  2 +-
 man/circleCub.Gauss.Rd            |  2 +-
 man/coerce-gpc-methods.Rd         |  8 ++---
 man/coerce-sp-methods.Rd          | 16 +++++----
 man/plotpolyf.Rd                  | 23 +++++++-----
 man/polyCub-package.Rd            |  8 ++---
 man/polyCub.Rd                    | 20 +++++------
 man/polyCub.SV.Rd                 |  8 ++---
 man/polyCub.exact.Gauss.Rd        | 17 ++++-----
 man/polyCub.iso.Rd                | 23 ++++++------
 man/polygauss.Rd                  |  8 ++---
 man/xylist.Rd                     |  2 +-
 src/init.c                        |  2 +-
 src/polyCub.SV.c                  |  2 +-
 src/polyCub.SV.h                  |  2 +-
 src/polyCub.iso.c                 | 11 +++---
 src/polyCub.iso.h                 |  2 +-
 tests/testthat/polyiso_powerlaw.c |  2 +-
 tests/testthat/test-regression.R  | 12 ++++---
 39 files changed, 375 insertions(+), 332 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 6610b67..f606c1c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: polyCub
 Title: Cubature over Polygonal Domains
-Version: 0.6.0
-Date: 2017-05-24
+Version: 0.6.1
+Date: 2017-10-02
 Authors at R: c(
     person("Sebastian", "Meyer",
            email = "seb.meyer at fau.de",
@@ -28,15 +28,15 @@ Description: The following methods for cubature (numerical integration)
 License: GPL-2
 URL: https://github.com/WastlM/polyCub
 BugReports: https://github.com/WastlM/polyCub/issues
-Depends: R (>= 2.15.0), methods, sp
-Imports: grDevices, graphics, stats, spatstat
-Suggests: lattice, testthat, mvtnorm, statmod, rgeos, gpclib
+Depends: R (>= 2.15.0), methods, sp (>= 1.0-11)
+Imports: grDevices, graphics, stats
+Suggests: spatstat, lattice, testthat, mvtnorm, statmod, rgeos, gpclib
 RoxygenNote: 6.0.1
 NeedsCompilation: yes
-Packaged: 2017-05-26 09:23:56 UTC; smeyer
+Packaged: 2017-10-02 14:57:04 UTC; smeyer
 Author: Sebastian Meyer [aut, cre, trl],
   Leonhard Held [ths],
   Michael Hoehle [ths]
 Maintainer: Sebastian Meyer <seb.meyer at fau.de>
 Repository: CRAN
-Date/Publication: 2017-05-26 10:05:58 UTC
+Date/Publication: 2017-10-02 15:49:17 UTC
diff --git a/MD5 b/MD5
index 2f936bf..db4df8a 100644
--- a/MD5
+++ b/MD5
@@ -1,53 +1,53 @@
-d4cd408a6dda4d4fd832fad0adcf4ebc *DESCRIPTION
-ebce3d96440b5368513e2d434be16a24 *NAMESPACE
-0a60a7ee72d69596c5c42d0e8070e42b *R/circleCub.R
-6c81138181a8c99ed924e298dec063d2 *R/coerce-gpc-methods.R
-866d2c71b8fdf86f02a1253cade4dbf4 *R/coerce-sp-methods.R
-671d2d34604542e536dea2027789228b *R/plotpolyf.R
-00f8503508c8fe19abb7e261193adff8 *R/polyCub.R
-d26a5f10f78a832a3dfd00d4e2b8e043 *R/polyCub.SV.R
-e352b88e0860a77b7df505008d722400 *R/polyCub.exact.Gauss.R
-6f6287cf77cd2e15bafbf5916dddeba1 *R/polyCub.iso.R
-33b9219de529db39375a1e04e593cea4 *R/polyCub.midpoint.R
+438d1a14a60e97d70f389dacb2546c8a *DESCRIPTION
+a6dc3b7fcabb8eafb4c8586a23468f0a *NAMESPACE
+19d40f1942c5088c42fe648f43614f51 *R/circleCub.R
+59d391e3544ef8697d2371fc7988a3cc *R/coerce-gpc-methods.R
+34b824603176d13102c02d1fe5826283 *R/coerce-sp-methods.R
+5295a3051e70064937101d985560511d *R/plotpolyf.R
+2d6a75533fa044e0ee0f9121c3406131 *R/polyCub.R
+b4e36eef011f4760b138c6eb3808f9df *R/polyCub.SV.R
+3986755656ca13a208d01ab08ccc650f *R/polyCub.exact.Gauss.R
+b189742e84f65250f5759d071731fcde *R/polyCub.iso.R
+7dc5afebd7e92cc577c2067dd829d66d *R/polyCub.midpoint.R
 75a1bb73253360d3ffdbb005b55f083f *R/sysdata.rda
-482735f9ca96e14ff8963614b524d63e *R/tools.R
-331b633713ef98289a6f462cc968c97c *R/xylist.R
-a9f5580a4daa787b5c36804c61336084 *R/zzz.R
-cae095e970caf0de622c4d4fc65fe38e *README.md
+81a26c8de73be4ad0b1108b9db90a67d *R/tools.R
+cf2448d45a3e90a86ea2da7411940de0 *R/xylist.R
+df516694ba96d2075bf97e14a94d3bd4 *R/zzz.R
+95e2ff0fbb02ba4ba5f7c000482d11ba *README.md
 915021f57341348a5f9348605269001e *inst/CITATION
-ade60c55007075ce440ccdd6ec24323b *inst/NEWS.Rd
-a2e8c8c02633c62187d4b62c80ed7bde *inst/examples/plotpolyf.R
-71c354b04903463684d7ee0c21afc397 *inst/examples/polyCub.R
-fec41191e00776d1cb4615e89d6e3612 *inst/examples/polyCub.iso.R
-fa7799fccf63a1561bb2ed114a2f07db *inst/include/polyCubAPI.h
+5be440a43ef60b2105c25c3665b52f24 *inst/NEWS.Rd
+42413ac762b1299f8839a6d44177a5d8 *inst/examples/plotpolyf.R
+400ead42d7003be5582e78cd17946c07 *inst/examples/polyCub.R
+39e559d406a3917df7a2a6b7d287deae *inst/examples/polyCub.iso.R
+af7c7fdb25a9f3fc0db625dbc9f26307 *inst/include/polyCubAPI.h
 48f7672ddb81a77f3793f2b26f4f9cbe *man/checkintrfr.Rd
-80c46e828a042699ab4e7500baf363f5 *man/circleCub.Gauss.Rd
-14855b08e09754316834a834f4dc2d22 *man/coerce-gpc-methods.Rd
-2b9885fd97c096fd4f553c35a4bb119f *man/coerce-sp-methods.Rd
+c9b66a346be26e28e9cfa79cce6d387f *man/circleCub.Gauss.Rd
+abbb7e1ef363a9db8fb04bae9982e803 *man/coerce-gpc-methods.Rd
+6050602f0ebcb375ea741ef5f4136e98 *man/coerce-sp-methods.Rd
 323f56fe3449f60180325c6263454377 *man/dotprod.Rd
 c38994de2c8de6f2372c42eb4ce915a4 *man/gpclibPermit.Rd
 db65b0e51cfcb8f175e6a32dc5c495e6 *man/isClosed.Rd
 b31e8ec92525bba018a7368f2d270ce2 *man/isScalar.Rd
 31f03498d486eeaef7ba89fec69a3415 *man/makegrid.Rd
 6f71baeb60ea79b309dd533de9bc3f0f *man/plot_polyregion.Rd
-4b162374f6661084873f7566033465be *man/plotpolyf.Rd
-414657ab72d2336196a2ae3dde718c2a *man/polyCub-package.Rd
-46a1bcad91a7041eb29af54604ddd2d7 *man/polyCub.Rd
-cebb825e063d60ddfa10ad67d39d18ea *man/polyCub.SV.Rd
-79c8a789e697e7afc5b148dd32d2c99a *man/polyCub.exact.Gauss.Rd
-74681dcd35af645008bb1e07239283a4 *man/polyCub.iso.Rd
+8f06fae1bf8aa2f50d7a918e598b20af *man/plotpolyf.Rd
+8c8741a653a08a5c03806b8036716891 *man/polyCub-package.Rd
+115c6cbabf430249998af7f1183c760e *man/polyCub.Rd
+492a74b4e140d7f11e10499c27f33c74 *man/polyCub.SV.Rd
+6848f055cc0e82f755a292f55224b569 *man/polyCub.exact.Gauss.Rd
+f253d5184c8bc8fa6e90cb13e242a2f5 *man/polyCub.iso.Rd
 33f30984750652e060b59fd0a9fd54b1 *man/polyCub.midpoint.Rd
-05a598d51ea290a90cf6ba4cfab5554f *man/polygauss.Rd
+099c8c3b006996cde118bdb35507b442 *man/polygauss.Rd
 3e57be2294c537ed441d6273872bd716 *man/vecnorm.Rd
-f2aa40b3e8ed1379ae7a2d51fd7d2eb9 *man/xylist.Rd
-17ed5a8294f4ffd649be6e4d710e9907 *src/init.c
-a18f7041fa9c917423f88b60fd000384 *src/polyCub.SV.c
-c88a07495cbb628e0bee68be96c46b5f *src/polyCub.SV.h
-da53b0e4064c5cf355e7a3eb37fe3819 *src/polyCub.iso.c
-9b7e40e6ba862b9d54817793c3827ec4 *src/polyCub.iso.h
+2b9d9db445fbbaca1411a2273c1198fe *man/xylist.Rd
+490daf10f0bef6930c2684af5cc7f477 *src/init.c
+bd2782f92e09d64dbea9e87f10b66f97 *src/polyCub.SV.c
+ce25a1a76b4cf52a0f34a1352640227d *src/polyCub.SV.h
+2ef3ee5c813c5281bec75b33eb6cb589 *src/polyCub.iso.c
+c16fcda4cc1fa1bf7c4e7cb9b97294d3 *src/polyCub.iso.h
 3e4e9e53ad2f425939503fd77e030cd2 *tests/test-all.R
-169ef46029292ff8bfae48ba27834b8c *tests/testthat/polyiso_powerlaw.c
+673cd0874ece8c19399eaf853af0457a *tests/testthat/polyiso_powerlaw.c
 b56f6ab7f21b2441ccd03873d4a1605c *tests/testthat/test-NWGL.R
 4076eacdcf7edcf0e376ecec57521d3f *tests/testthat/test-polyCub.R
 4222d51ae8cc74424b8fbf735c1bb55c *tests/testthat/test-polyiso.R
-f60d877c5efbec6d36927cfd1fd2a4d5 *tests/testthat/test-regression.R
+754cef6b76758b994c545474befd1205 *tests/testthat/test-regression.R
diff --git a/NAMESPACE b/NAMESPACE
index 2703a8d..572a8b7 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,9 +1,5 @@
 # Generated by roxygen2: do not edit by hand
 
-S3method(as.owin,Polygon)
-S3method(as.owin,Polygons)
-S3method(as.owin,SpatialPolygons)
-S3method(as.owin,gpc.poly)
 S3method(xylist,Polygon)
 S3method(xylist,Polygons)
 S3method(xylist,SpatialPolygons)
@@ -11,6 +7,10 @@ S3method(xylist,default)
 S3method(xylist,gpc.poly)
 S3method(xylist,owin)
 export(.polyCub.iso)
+export(as.owin.Polygon)
+export(as.owin.Polygons)
+export(as.owin.SpatialPolygons)
+export(as.owin.gpc.poly)
 export(checkintrfr)
 export(circleCub.Gauss)
 export(gpc2owin)
@@ -27,6 +27,7 @@ export(xylist)
 exportMethods(coerce)
 import(methods)
 import(sp)
+importClassesFrom(sp,owin)
 importFrom(grDevices,extendrange)
 importFrom(grDevices,gray)
 importFrom(grDevices,heat.colors)
@@ -35,15 +36,6 @@ importFrom(graphics,image)
 importFrom(graphics,lines)
 importFrom(graphics,points)
 importFrom(graphics,polygon)
-importFrom(spatstat,as.im.function)
-importFrom(spatstat,as.owin)
-importFrom(spatstat,as.polygonal)
-importFrom(spatstat,integral.im)
-importFrom(spatstat,is.polygonal)
-importFrom(spatstat,owin)
-importFrom(spatstat,plot.im)
-importFrom(spatstat,plot.owin)
-importFrom(spatstat,summary.owin)
 importFrom(stats,cov2cor)
 importFrom(stats,dist)
 importFrom(stats,integrate)
diff --git a/R/circleCub.R b/R/circleCub.R
index 448ca96..dc6176e 100644
--- a/R/circleCub.R
+++ b/R/circleCub.R
@@ -1,12 +1,11 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### Integration of the Isotropic Gaussian Density over Circular Domains
 ###
 ### Copyright (C) 2013-2014 Sebastian Meyer
-### Time-stamp: <[circleCub.R] by SM Die 06/05/2014 10:02 (CEST)>
 ###
-### Special cases of cubature over circular domains (center, r)
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -17,20 +16,20 @@
 ##' the cumulative distribution function of the (non-central) Chi-Squared
 ##' distribution (\code{pchisq}), cp. Formula 26.3.24 in Abramowitz and Stegun
 ##' (1972).
-##' 
+##'
 ##' @references
 ##' Abramowitz, M. and Stegun, I. A. (1972).
 ##' Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical
 ##' Tables. New York: Dover Publications.
 ##' @param center numeric vector of length 2 (center of the circle).
-##' @param r numeric (radius of the circle). Several radii may be supplied. 
+##' @param r numeric (radius of the circle). Several radii may be supplied.
 ##' @param mean numeric vector of length 2
 ##'             (mean of the bivariate Gaussian density).
 ##' @param sd numeric (common standard deviation of the isotropic
 ##'           Gaussian density in both dimensions).
 ##' @return The integral value (one for each supplied radius).
 ##' @note The non-centrality parameter of the evaluated chi-squared distribution
-##' equals the squared distance between the \code{mean} and the 
+##' equals the squared distance between the \code{mean} and the
 ##' \code{center}. If this becomes too large, the result becomes inaccurate, see
 ##' \code{\link{pchisq}}.
 ##' @keywords math spatial
diff --git a/R/coerce-gpc-methods.R b/R/coerce-gpc-methods.R
index fe5e23c..4631744 100644
--- a/R/coerce-gpc-methods.R
+++ b/R/coerce-gpc-methods.R
@@ -1,22 +1,23 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### Conversion between polygonal "owin" and "gpc.poly"
 ###
-### Copyright (C) 2012-2015 Sebastian Meyer
-### Time-stamp: <[coerce-gpc-methods.R] 2015-02-25 21:07 (CET) by SM>
+### Copyright (C) 2012-2015,2017 Sebastian Meyer
+###
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
 ##' Conversion between polygonal \code{"owin"} and \code{"gpc.poly"}
-##' 
-##' Package \pkg{polyCub} implements converters between the classes 
-##' \code{"\link[=owin.object]{owin}"} of package \pkg{spatstat} and
+##'
+##' Package \pkg{polyCub} implements converters between the classes
+##' \code{"\link[spatstat:owin.object]{owin}"} of package \pkg{spatstat} and
 ##' \code{"\link[rgeos:gpc.poly-class]{gpc.poly}"} of package \pkg{rgeos}
 ##' (originally from \pkg{gpclib}).
 ##' Support for the \code{"gpc.poly"} class was dropped from
 ##' \pkg{spatstat} as of version 1.34-0.
-##' 
+##'
 ##' @param object an object of class \code{"gpc.poly"} or \code{"owin"},
 ##' respectively.
 ##' @return The converted polygon of class \code{"gpc.poly"} or \code{"owin"},
@@ -35,25 +36,22 @@
 ##' @name coerce-gpc-methods
 ##' @rdname coerce-gpc-methods
 ##' @keywords spatial methods
-##' @importFrom spatstat as.polygonal summary.owin
 ##' @import methods
 ##' @export
 owin2gpc <- function (object)
 {
-    object <- as.polygonal(object)
-    
-    ## FIXME: spatstat functions to extract the areas and hole flags
-    ## of the individual polygons in a polygonal "owin" would be nice
-    holes <- summary.owin(object)$areas < 0
+    object <- spatstat::as.polygonal(object)
+
+    ## determine hole flags of the individual polygons
+    hole <- spatstat::summary.owin(object)$areas < 0
 
     ## reverse vertices and set hole flags
     pts <- mapply(
         FUN = function (poly, hole) {
-            list(x = rev(poly$x), y = rev(poly$y), hole = hole)
-            ## or hole = area.owin(owin(poly = poly, check = FALSE)) < 0,
-            ## but spatstat::is.hole.xypolygon is marked as an internal function
+            list(x = rev.default(poly$x), y = rev.default(poly$y),
+                 hole = hole)  # or spatstat.utils::is.hole.xypolygon(poly)
         },
-        poly = object$bdry, hole = holes,
+        poly = object$bdry, hole = hole,
         SIMPLIFY = FALSE, USE.NAMES = FALSE)
 
     ## formal class
@@ -66,18 +64,17 @@ owin2gpc <- function (object)
 }
 
 ##' @inheritParams owin2gpc
-##' @param ... further arguments passed to \code{\link{owin}}.
+##' @param ... further arguments passed to \code{\link[spatstat]{owin}}.
 ##' @rdname coerce-gpc-methods
-##' @importFrom spatstat owin summary.owin
 ##' @export
 gpc2owin <- function (object, ...)
 {
     ## first convert to an "owin" without checking areas etc.
     ## to determine the hole status according to vertex order (area)
-    res <- owin(poly = object at pts, check = FALSE)
-    holes_owin <- summary.owin(res)$areas < 0
-    ## Note: cannot rely on spatstat::Area.xypolygon since it is marked internal
-    
+    res <- spatstat::owin(poly = object at pts, check = FALSE)
+    holes_owin <- spatstat::summary.owin(res)$areas < 0
+    ## or directly lapply spatstat.utils::is.hole.xypolygon
+
     ## now fix the vertex order
     bdry <- mapply(
         FUN = function (poly, owinhole) {
@@ -91,14 +88,12 @@ gpc2owin <- function (object, ...)
         SIMPLIFY = FALSE, USE.NAMES = FALSE)
 
     ## now really convert to owin with appropriate vertex order
-    owin(poly = bdry, ...)
+    spatstat::owin(poly = bdry, ...)
 }
 
 ##' @inheritParams gpc2owin
 ##' @param W an object of class \code{"gpc.poly"}.
 ##' @rdname coerce-gpc-methods
-##' @importFrom spatstat as.owin
-##' @method as.owin gpc.poly
 ##' @export
 as.owin.gpc.poly <- function (W, ...)
 {
diff --git a/R/coerce-sp-methods.R b/R/coerce-sp-methods.R
index e3040ea..fe25b6a 100644
--- a/R/coerce-sp-methods.R
+++ b/R/coerce-sp-methods.R
@@ -1,21 +1,24 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### as.owin.SpatialPolygons: Coerce "SpatialPolygons" to "owin"
 ###
-### Copyright (C) 2012-2013, 2015 Sebastian Meyer
-### Time-stamp: <[coerce-sp-methods.R] 2015-02-25 22:43 (CET) by SM>
+### Copyright (C) 2012-2013,2015,2017 Sebastian Meyer
+###
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
 ##' Coerce \code{"SpatialPolygons"} to \code{"owin"}
-##' 
+##'
 ##' Package \pkg{polyCub} implements \code{coerce}-methods
 ##' (\code{as(object, Class)}) to convert \code{"\linkS4class{SpatialPolygons}"}
 ##' (or \code{"\linkS4class{Polygons}"} or \code{"\linkS4class{Polygon}"})
-##' to \code{"\link[=owin.object]{owin}"}.
-##' They are also registered as \code{\link{as.owin}}-methods to support
-##' \code{\link{polyCub.midpoint}}.
+##' to \code{"\link[spatstat:owin.object]{owin}"}.
+##' They are also available as \code{as.owin.*} functions to support
+##' \code{\link{polyCub.midpoint}}. However, these are no registered S3 methods
+##' for \code{\link[spatstat]{as.owin}}, since package \pkg{spatstat} is
+##' optional.
 ##' Note that the \pkg{maptools} package contains an alternative implementation
 ##' of coercion from \code{"SpatialPolygons"} to \code{"owin"} (and reverse),
 ##' and \R will use the S4 \code{coerce}-method that was loaded last,
@@ -30,27 +33,21 @@ NULL
 
 ##' @param W an object of class \code{"SpatialPolygons"},
 ##' \code{"Polygons"}, or \code{"Polygon"}.
-##' @param ... further arguments passed to \code{\link{owin}}.
+##' @param ... further arguments passed to \code{\link[spatstat]{owin}}.
 ##' @rdname coerce-sp-methods
-##' @importFrom spatstat owin
-##' @method as.owin SpatialPolygons
 ##' @export
 as.owin.SpatialPolygons <- function (W, ...)
-    owin(poly = xylist.SpatialPolygons(W), ...)
+    spatstat::owin(poly = xylist.SpatialPolygons(W), ...)
 
 ##' @rdname coerce-sp-methods
-##' @importFrom spatstat owin
-##' @method as.owin Polygons
 ##' @export
 as.owin.Polygons <- function (W, ...)
-    owin(poly = xylist.Polygons(W), ...)
+    spatstat::owin(poly = xylist.Polygons(W), ...)
 
 ##' @rdname coerce-sp-methods
-##' @importFrom spatstat owin
-##' @method as.owin Polygon
 ##' @export
 as.owin.Polygon <- function (W, ...)
-    owin(poly = xylist.Polygon(W), ...)
+    spatstat::owin(poly = xylist.Polygon(W), ...)
 
 
 ## Register "owin" as class in S4 so we can define methods for it
@@ -58,9 +55,9 @@ as.owin.Polygon <- function (W, ...)
 ## -> no need to register "owin", since we depend on sp which does it !
 ## Otherwise we would get the following warning upon package installation:
 ## Warning in .simpleDuplicateClass(def, prev) :
-##   the specification for class "owin" in package 'polyCub' seems 
+##   the specification for class "owin" in package 'polyCub' seems
 ##   equivalent to one from package 'sp' and is not turning on
-##   duplicate class definitions for this class 
+##   duplicate class definitions for this class
 ## Using setOldClass("owin") is incompatible with package "maptools", which
 ## does setClass("owin") _and_ exports this class! Specifically, loading
 ## library("polyCub"); library("maptools"); library("gpclib")
@@ -71,6 +68,7 @@ as.owin.Polygon <- function (W, ...)
 ## re-installed)
 ## Error: package/namespace load failed for 'gpclib'
 
+##' @importClassesFrom sp owin
 ##' @name coerce,SpatialPolygons,owin-method
 ##' @rdname coerce-sp-methods
 setAs(from = "SpatialPolygons", to = "owin",
diff --git a/R/plotpolyf.R b/R/plotpolyf.R
index a725752..f92cdfd 100644
--- a/R/plotpolyf.R
+++ b/R/plotpolyf.R
@@ -1,12 +1,11 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### plotpolyf: Plot Polygonal Domain on Image of Bivariate Function
 ###
 ### Copyright (C) 2013-2014 Sebastian Meyer
-### Time-stamp: <[plotpolyf.R] 2014-09-27 14:39 (CEST) by SM>
 ###
-### Plot polygonal domain with image of bivariate function
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -15,7 +14,7 @@
 ##' Produces a combined plot of a polygonal domain and an image of a bivariate
 ##' function, using either \code{\link[lattice:levelplot]{lattice::levelplot}}
 ##' or \code{\link{image}}.
-##' 
+##'
 ##' @param polyregion a polygonal domain.
 ##' The following classes are supported: \code{"\link[spatstat]{owin}"},
 ##' \code{"\link[rgeos:gpc.poly-class]{gpc.poly}"},
@@ -38,8 +37,8 @@
 ##' @param use.lattice logical indicating if \pkg{lattice} graphics
 ##' (\code{\link[lattice]{levelplot}}) should be used.
 ##' @param print.args a list of arguments passed to \code{\link{print.trellis}}
-##' for plotting the produced \code{\link[=trellis.object]{"trellis"}} object
-##' (given \code{use.lattice = TRUE}). The latter will be returned without 
+##' for plotting the produced \code{\link[lattice:trellis.object]{"trellis"}} object
+##' (given \code{use.lattice = TRUE}). The latter will be returned without
 ##' explicit \code{print}ing if \code{print.args} is not a list.
 ##' @author Sebastian Meyer
 ##' @keywords hplot
diff --git a/R/polyCub.R b/R/polyCub.R
index 966518c..e610b16 100644
--- a/R/polyCub.R
+++ b/R/polyCub.R
@@ -1,10 +1,11 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### polyCub: Wrapper Function for the Various Cubature Methods
 ###
 ### Copyright (C) 2009-2013 Sebastian Meyer
-### Time-stamp: <[polyCub.R] by SM Sam 06/07/2013 12:52 (CEST)>
+###
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -12,7 +13,7 @@
 #'
 #' Instead of calling one of the specific cubature methods of this package, the
 #' wrapper function \code{polyCub} may be used together with the \code{method}
-#' argument. 
+#' argument.
 #'
 #' @param polyregion a polygonal integration domain.
 #' The supported classes depend on the specific method, however, the
diff --git a/R/polyCub.SV.R b/R/polyCub.SV.R
index a399d05..dfd05f8 100644
--- a/R/polyCub.SV.R
+++ b/R/polyCub.SV.R
@@ -5,7 +5,7 @@
 ###
 ### This file is part of the R package "polyCub",
 ### free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.R-project.org/Licenses/.
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -38,14 +38,14 @@
 ##' convex polygons, this rotation guarantees that all nodes fall inside the
 ##' polygon.
 ##' @param engine character string specifying the implementation to use.
-##' Up to \pkg{polyCub} version 0.4-3, the two-dimensional nodes and weights 
+##' Up to \pkg{polyCub} version 0.4-3, the two-dimensional nodes and weights
 ##' were computed by \R functions and these are still available by setting
 ##' \code{engine = "R"}.
-##' The new C-implementation is now the default (\code{engine = "C"}) and 
+##' The new C-implementation is now the default (\code{engine = "C"}) and
 ##' requires approximately 30\% less computation time.\cr
 ##' The special setting \code{engine = "C+reduce"} will discard redundant nodes
 ##' at (0,0) with zero weight resulting from edges on the base-line
-##' \eqn{x = \alpha} or orthogonal to it. 
+##' \eqn{x = \alpha} or orthogonal to it.
 ##' This extra cleaning is only worth its cost for computationally intensive
 ##' functions \code{f} over polygons which really have some edges on the
 ##' baseline or parallel to the x-axis.  Note that the old \R
@@ -67,7 +67,7 @@
 ##' @references
 ##' Sommariva, A. and Vianello, M. (2007).
 ##' Product Gauss cubature over polygons based on Green's integration formula.
-##' \emph{Bit Numerical Mathematics}, \bold{47} (2), 441-453.
+##' \emph{BIT Numerical Mathematics}, \bold{47} (2), 441-453.
 ##' @keywords math spatial
 ##' @family polyCub-methods
 ##' @importFrom graphics points
@@ -95,7 +95,7 @@ polyCub.SV <- function (polyregion, f, ...,
         return(lapply(X = polys, FUN = polygauss, nw_MN = c(nw_M, nw_N),
                       alpha = alpha, rotation = rotation, engine = engine))
     }
-    
+
     ## Cubature over every single polygon of the "polys" list
     f <- match.fun(f)
     int1 <- function (poly) {
@@ -151,14 +151,14 @@ gauss.quad <- function (n)
 ##' @references
 ##' Sommariva, A. and Vianello, M. (2007):
 ##' Product Gauss cubature over polygons based on Green's integration formula.
-##' \emph{Bit Numerical Mathematics}, \bold{47} (2), 441-453.
+##' \emph{BIT Numerical Mathematics}, \bold{47} (2), 441-453.
 ##' @keywords internal
 ##' @useDynLib polyCub, .registration = TRUE
 
 polygauss <- function (xy, nw_MN, alpha = NULL, rotation = FALSE, engine = "C")
 {
     ## POLYGON ROTATION
-    
+
     xyrot <- if (identical(FALSE, rotation)) {
         if (is.null(alpha)) { # choose midpoint of x-range
             xrange <- range(xy[["x"]])
@@ -198,12 +198,12 @@ polygauss <- function (xy, nw_MN, alpha = NULL, rotation = FALSE, engine = "C")
 
     ## number of vertices
     L <- length(xyrot[[1L]])
-    
-    
+
+
     ## COMPUTE 2D NODES AND WEIGHTS.
-    
+
     if (engine == "R") {
-        
+
         toIdx <- c(seq.int(2, L), 1L)
         nwlist <- mapply(.polygauss.side,
                          xyrot[[1L]], xyrot[[2L]],
@@ -233,7 +233,7 @@ polygauss <- function (xy, nw_MN, alpha = NULL, rotation = FALSE, engine = "C")
                      as.double(alpha),
                      as.integer(L), as.integer(M), as.integer(N),
                      x = zerovec, y = zerovec, w = zerovec)[c("x", "y", "w")]
-        
+
         nodes <- cbind(nwlist[[1L]], nwlist[[2L]], deparse.level=0)
         weights <- nwlist[[3L]]
 
@@ -261,18 +261,18 @@ polygauss <- function (xy, nw_MN, alpha = NULL, rotation = FALSE, engine = "C")
     if ((x1 == alpha && x2 == alpha) || (y2 == y1))
         ## side lies on base-line or is orthogonal to it -> skip
         return(NULL)
-    
+
     if (x2 == x1) { # side is parallel to base-line => degree N
         s_loc <- s_N
         w_loc <- w_N
     }
-    
+
     half_pt_x <- (x1+x2)/2
     half_length_x <- (x2-x1)/2
-    
+
     half_pt_y <- (y1+y2)/2
     half_length_y <- (y2-y1)/2
-    
+
     ## GAUSSIAN POINTS ON THE SIDE.
     x_gauss_side <- half_pt_x + half_length_x * s_loc
     y_gauss_side <- half_pt_y + half_length_y * s_loc
@@ -320,24 +320,24 @@ vertexpairmaxdist <- function (xy)
     ## compute euclidean distance matrix
     distances <- dist(xy)
     size <- attr(distances, "Size")
-    
+
     ## select two points with maximum distance
     maxdistidx <- which.max(distances)
     lowertri <- seq_along(distances) == maxdistidx
     mat <- matrix(FALSE, size, size)
     mat[lower.tri(mat)] <- lowertri
     QPidx <- which(mat, arr.ind=TRUE, useNames=FALSE)[1L,]
-    xy[QPidx,]    
+    xy[QPidx,]
 }
 
 rotmatPQ <- function (P, Q)
 {
     direction_axis <- (Q-P) / sqrt(sum((Q-P)^2))
-    
+
     ## determine rotation angle
     rot_angle_x <- acos(direction_axis[1L])
     rot_angle_y <- acos(direction_axis[2L])
-    
+
     rot_angle <- if (rot_angle_y <= pi/2) {
         if (rot_angle_x <= pi/2) -rot_angle_y else rot_angle_y
     } else {
diff --git a/R/polyCub.exact.Gauss.R b/R/polyCub.exact.Gauss.R
index 62b7fee..2250e0a 100644
--- a/R/polyCub.exact.Gauss.R
+++ b/R/polyCub.exact.Gauss.R
@@ -1,38 +1,39 @@
 ################################################################################
 ### polyCub.exact.Gauss: Quasi-Exact Cubature of the Bivariate Normal Density
 ###
-### Copyright (C) 2009-2016 Sebastian Meyer
+### Copyright (C) 2009-2017 Sebastian Meyer
 ###
 ### This file is part of the R package "polyCub",
 ### free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
 #' Quasi-Exact Cubature of the Bivariate Normal Density
 #'
 #' Integration is based on triangulation of the (transformed) polygonal domain
-#' and formulae from the 
+#' and formulae from the
 #' Abramowitz and Stegun (1972) handbook (Section 26.9, Example 9, pp. 956f.).
 #' This method is quite cumbersome because the A&S formula is only for triangles
 #' where one vertex is the origin (0,0). For each triangle of the
-#' \code{\link[gpclib]{tristrip}} we have to check in which of the 6 outer 
-#' regions of the triangle the origin (0,0) lies and adapt the signs in the 
+#' \code{\link[gpclib]{tristrip}} we have to check in which of the 6 outer
+#' regions of the triangle the origin (0,0) lies and adapt the signs in the
 #' formula appropriately: \eqn{(AOB+BOC-AOC)} or \eqn{(AOB-AOC-BOC)} or
 #' \eqn{(AOB+AOC-BOC)} or \eqn{(AOC+BOC-AOB)} or \ldots.
 #' However, the most time consuming step is the
 #' evaluation of \code{\link[mvtnorm]{pmvnorm}}.
-#' 
-#' @note The package \pkg{gpclib} (which is required to produce the
-#' \code{tristrip}, since this is not yet implemented in \pkg{rgeos})
-#' has a restricted license (commercial use prohibited).
-#' It has to be accepted explicitly via
+#'
+#' @note The package \pkg{gpclib} is required to produce the
+#' \code{tristrip}, since this is not implemented in \pkg{rgeos}
+#' (as of version 0.3-25).
+#' The restricted license of \pkg{gpclib} (commercial use prohibited)
+#' has to be accepted explicitly via
 #' \code{\link{gpclibPermit}()} prior to using \code{polyCub.exact.Gauss}.
 #'
 #' @param polyregion a \code{"\link[rgeos:gpc.poly-class]{gpc.poly}"} polygon or
 #' something that can be coerced to this class, e.g., an \code{"owin"} polygon
 #' (converted via \code{\link{owin2gpc}} and -- given \pkg{rgeos} is available
-#' -- \code{"SpatialPolygons"} also work. 
+#' -- \code{"SpatialPolygons"} also work.
 #' @param mean,Sigma mean and covariance matrix of the bivariate normal density
 #' to be integrated.
 #' @param plot logical indicating if an illustrative plot of the numerical
@@ -41,7 +42,7 @@
 #' @return The integral of the bivariate normal density over \code{polyregion}.
 #' Two attributes are appended to the integral value:
 #' \item{nEval}{
-#' number of triangles over which the standard bivariate normal density had to 
+#' number of triangles over which the standard bivariate normal density had to
 #' be integrated, i.e. number of calls to \code{\link[mvtnorm]{pmvnorm}} and
 #' \code{\link[stats]{pnorm}}, the former of which being the most time-consuming
 #' operation.
@@ -64,7 +65,6 @@
 #' @import methods
 #' @import sp
 #' @importFrom stats cov2cor
-#' @importFrom spatstat is.polygonal
 #' @importFrom graphics lines
 #' @export
 ## NOTE: we don't import graphics::plot since it is already imported via sp
@@ -73,7 +73,7 @@ polyCub.exact.Gauss <- function (polyregion, mean = c(0,0), Sigma = diag(2),
                                  plot = FALSE)
 {
     gpclibCheck(fatal=TRUE)
-    if (is.polygonal(polyregion)) {
+    if (inherits(polyregion, "owin")) {
         polyregion <- owin2gpc(polyregion)
     } else if (!inherits(polyregion, "gpc.poly")) {
         if (inherits(polyregion, "SpatialPolygons") &&
@@ -83,15 +83,15 @@ polyCub.exact.Gauss <- function (polyregion, mean = c(0,0), Sigma = diag(2),
         }
         polyregion <- as(polyregion, "gpc.poly")
     }
-    
+
     ## coordinate transformation so that the standard bivariat normal density
     ## can be used in integrations (cf. formula 26.3.22)
     polyregion at pts <- transform_pts(polyregion at pts, mean = mean, Sigma = Sigma)
-    
+
     ## triangulation: tristrip() returns a list where each element is a
-    ## coordinate matrix of vertices of triangles 
+    ## coordinate matrix of vertices of triangles
     triangleSets <- gpclib::tristrip(polyregion)
-    
+
 ### ILLUSTRATION ###
     if (plot) {
         plot(polyregion, poly.args=list(lwd=2), ann=FALSE)
@@ -111,7 +111,7 @@ polyCub.exact.Gauss <- function (polyregion, mean = c(0,0), Sigma = diag(2),
         c(int, nTriangles, error)
     }, FUN.VALUE = numeric(3L), USE.NAMES = FALSE)
     int <- sum(integrals[1,])
-    
+
     ## number of .V() evaluations (if there were no degenerate triangles)
     attr(int, "nEval") <- 6 * sum(integrals[2,])
     ## approximate absolute integration error
@@ -153,12 +153,12 @@ transform_pts <- function (pts, mean, Sigma)
     intAOB <- .intTriangleAS0(A, B)
     intBOC <- .intTriangleAS0(B, C)
     intAOC <- .intTriangleAS0(A, C)
-    
+
     # determine signs of integrals
     signAOB <- -1 + 2*.pointsOnSameSide(A,B,C)
     signBOC <- -1 + 2*.pointsOnSameSide(B,C,A)
     signAOC <- -1 + 2*.pointsOnSameSide(A,C,B)
-    
+
     int <- signAOB*intAOB + signBOC*intBOC + signAOC*intAOC
     attr(int, "error") <- attr(intAOB, "error") +
         attr(intBOC, "error") + attr(intAOC, "error")
@@ -173,7 +173,7 @@ transform_pts <- function (pts, mean, Sigma)
     h <- abs(B[2L]*A[1L] - A[2L]*B[1L]) / d   # distance of AB to the origin
     if (d == 0 || h == 0) # degenerate triangle: A == B or 0, A, B on a line
         return(structure(0, error = 0))
-    
+
     k1 <- dotprod(A, BmA) / d
     k2 <- dotprod(B, BmA) / d
     V2 <- .V(h, abs(k2))
diff --git a/R/polyCub.iso.R b/R/polyCub.iso.R
index 88bc64d..edc5a85 100644
--- a/R/polyCub.iso.R
+++ b/R/polyCub.iso.R
@@ -5,7 +5,7 @@
 ###
 ### This file is part of the R package "polyCub",
 ### free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -60,8 +60,8 @@
 #' Meyer, S. and Held, L. (2014).
 #' Power-law models for infectious disease spread.
 #' \emph{The Annals of Applied Statistics}, \bold{8} (3), 1612-1639.\cr
-#' DOI-Link: \url{http://dx.doi.org/10.1214/14-AOAS743},
-#' \href{http://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
+#' DOI-Link: \url{https://doi.org/10.1214/14-AOAS743},
+#' \href{https://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
 #' @seealso
 #' \code{system.file("include", "polyCubAPI.h", package = "polyCub")}
 #' for a full C-implementation of this cubature method (for a \emph{single}
diff --git a/R/polyCub.midpoint.R b/R/polyCub.midpoint.R
index 0d207ad..9172cab 100644
--- a/R/polyCub.midpoint.R
+++ b/R/polyCub.midpoint.R
@@ -1,10 +1,11 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### polyCub.midpoint: Two-Dimensional Midpoint Rule
 ###
-### Copyright (C) 2009-2015 Sebastian Meyer
-### Time-stamp: <[polyCub.midpoint.R] 2015-02-25 20:53 (CET) by SM>
+### Copyright (C) 2009-2015,2017 Sebastian Meyer
+###
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -15,7 +16,7 @@
 #' \pkg{spatstat} (Baddeley and Turner, 2005).
 #' The integral under the surface is then approximated as the
 #' sum over (pixel area * f(pixel midpoint)).
-#' 
+#'
 #' @inheritParams plotpolyf
 #' @param polyregion a polygonal integration domain.
 #' It can be any object coercible to the \pkg{spatstat} class
@@ -40,7 +41,6 @@
 #' @keywords math spatial
 #' @family polyCub-methods
 #' @import sp
-#' @importFrom spatstat as.im.function plot.im integral.im
 #' @importFrom grDevices gray
 #' @examples # see example(polyCub)
 #' @export
@@ -54,7 +54,7 @@ polyCub.midpoint <- function (polyregion, f, ...,
 
     ## calculate pixel values of fxy
     IM <- tryCatch(
-          as.im.function(X=fxy, W=polyregion, ..., eps=eps, dimyx=dimyx),
+          spatstat::as.im.function(X=fxy, W=polyregion, ..., eps=eps, dimyx=dimyx),
           error = function (e) {
               ## if eps was to small such that the dimensions of the image would
               ## be too big then the operation matrix(TRUE, nr, nc) throws an
@@ -64,17 +64,17 @@ polyCub.midpoint <- function (polyregion, f, ...,
               stop("inapplicable choice of bandwidth (eps=", format(eps),
                    ") in midpoint rule:\n", e)
           })
-    
+
 ### ILLUSTRATION ###
     if (plot) {
-        plot.im(IM, axes=TRUE, col=gray(31:4/35), main="")
+        spatstat::plot.im(IM, axes=TRUE, col=gray(31:4/35), main="")
         ## add evaluation points
         #with(IM, points(expand.grid(xcol, yrow), col=!is.na(v), cex=0.5))
         plot(polyregion, add=TRUE, poly.args=list(lwd=2), lwd=2)
         ##<- two 'lwd'-specifications such that it works with owin and gpc.poly
     }
 ####################
-    
+
     ## return the approximated integral
-    integral.im(IM)
+    spatstat::integral.im(IM)
 }
diff --git a/R/tools.R b/R/tools.R
index 0667d04..6a36ee3 100644
--- a/R/tools.R
+++ b/R/tools.R
@@ -1,12 +1,11 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### Internal Functions
 ###
-### Copyright (C) 2009-2015 Sebastian Meyer
-### Time-stamp: <[tools.R] 2015-01-05 23:20 (CET) by SM>
+### Copyright (C) 2009-2015,2017 Sebastian Meyer
 ###
-### Tiny toolbox of internal function
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -43,9 +42,9 @@ dotprod <- function (x,y) sum(x*y)
 ##' @return \code{sqrt(sum(x^2))}
 ##' @keywords math internal
 vecnorm <- function (x) sqrt(sum(x^2))
-    
+
 ##' Checks if Argument is Scalar
-##' 
+##'
 ##' Check if the argument is scalar, i.e. a numeric vector of length 1.
 ##' @param x any object
 ##' @return logical
@@ -62,9 +61,6 @@ isScalar <- function (x) {
 ##' @import methods
 ##' @import sp
 ##' @importFrom graphics polygon
-##' @importFrom spatstat plot.owin
-## CAVE: need to import plot.owin for compatibility with spatstat <1.33-0,
-##       since plot.owin was not registered as an S3-method for plot
 ## NOTE: we don't import graphics::plot since it is already imported via sp
 plot_polyregion <- function (polyregion, lwd=2, add=FALSE)
 {
@@ -79,6 +75,9 @@ plot_polyregion <- function (polyregion, lwd=2, add=FALSE)
             polyregion <- Polygons(list(polyregion), "ID")
         if (inherits(polyregion, "Polygons"))
             polyregion <- SpatialPolygons(list(polyregion))
+        if (inherits(polyregion, "owin"))
+            ## && ! "plot.owin" %in% getNamespaceInfo("spatstat", "S3methods")
+            plot <- spatstat::plot.owin  # spatstat <1.33-0 has no registration
         ## plot call which works for "SpatialPolygons" and "owin"
         plot(polyregion, lwd=lwd, axes=TRUE, main="", add=add)
     }
@@ -86,7 +85,7 @@ plot_polyregion <- function (polyregion, lwd=2, add=FALSE)
 
 
 ##' Constructs Equally-Spaced Grid
-##' 
+##'
 ##' Construct an equally-spaced grid given a range and the number of cut points
 ##' (one more than the number of resulting bins).
 ##' This is nothing else than \code{seq(range[1], range[2], length.out=n)}.
diff --git a/R/xylist.R b/R/xylist.R
index 9598373..fb8635e 100644
--- a/R/xylist.R
+++ b/R/xylist.R
@@ -1,15 +1,16 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### xylist: Convert Various Polygon Classes to a Simple List of Vertices
 ###
-### Copyright (C) 2012-2014 Sebastian Meyer
-### Time-stamp: <[xylist.R] 2015-02-25 21:18 (CET) by SM>
+### Copyright (C) 2012-2014,2017 Sebastian Meyer
+###
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
 ##' Convert Various Polygon Classes to a Simple List of Vertices
-##' 
+##'
 ##' Different packages concerned with spatial data use different polygon
 ##' specifications, which sometimes becomes very confusing (see Details below).
 ##' To be compatible with the various polygon classes, package \pkg{polyCub}
@@ -19,7 +20,7 @@
 ##' The generic function \code{xylist} can deal with the
 ##' following polygon classes:
 ##' \itemize{
-##' \item{\code{"\link[=owin.object]{owin}"} from package \pkg{spatstat}}
+##' \item{\code{"\link[spatstat:owin.object]{owin}"} from package \pkg{spatstat}}
 ##' \item{\code{"\link[rgeos:gpc.poly-class]{gpc.poly}"} from package
 ##' \pkg{rgeos} (or \pkg{gpclib})}
 ##' \item{\code{"\linkS4class{Polygons}"} from package \pkg{sp}
@@ -29,7 +30,7 @@
 ##' The (somehow useless) default \code{xylist}-method
 ##' does not perform any transformation but only ensures that the polygons are
 ##' not closed (first vertex not repeated).
-##' 
+##'
 ##' Different packages concerned with spatial data use different polygon
 ##' specifications with respect to:
 ##' \itemize{
@@ -62,11 +63,10 @@
 xylist <- function (object, ...) UseMethod("xylist")
 
 ##' @rdname xylist
-##' @importFrom spatstat as.polygonal
 ##' @export
 xylist.owin <- function (object, ...)
 {
-    as.polygonal(object)$bdry
+    spatstat::as.polygonal(object)$bdry
 }
 
 ##' @rdname xylist
diff --git a/R/zzz.R b/R/zzz.R
index fadaba5..8f14777 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -1,12 +1,11 @@
 ################################################################################
-### Part of the R package "polyCub".
-### Free software under the terms of the GNU General Public License, version 2,
-### a copy of which is available at http://www.r-project.org/Licenses/.
+### Package Setup
 ###
 ### Copyright (C) 2009-2014 Sebastian Meyer
-### Time-stamp: <[zzz.R] 2014-10-24 11:11 (CEST) by SM>
 ###
-### Package administration
+### This file is part of the R package "polyCub",
+### free software under the terms of the GNU General Public License, version 2,
+### a copy of which is available at https://www.R-project.org/Licenses/.
 ################################################################################
 
 
@@ -14,7 +13,7 @@
 #'
 #' The \R package \pkg{polyCub} provides methods for \strong{cubature}
 #' (numerical integration) \strong{over polygonal domains}.
-#' The function \code{\link{polyCub}()} is the main entry point of the package. 
+#' The function \code{\link{polyCub}()} is the main entry point of the package.
 #' It is a wrapper around the specific cubature methods listed below.
 #'
 #' \describe{
@@ -66,12 +65,12 @@
 #' Meyer, S. and Held, L. (2014).
 #' Power-law models for infectious disease spread.
 #' \emph{The Annals of Applied Statistics}, \bold{8} (3), 1612-1639.\cr
-#' DOI-Link: \url{http://dx.doi.org/10.1214/14-AOAS743},
-#' \href{http://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
-#' 
+#' DOI-Link: \url{https://doi.org/10.1214/14-AOAS743},
+#' \href{https://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
+#'
 #' Sommariva, A. and Vianello, M. (2007).
 #' Product Gauss cubature over polygons based on Green's integration formula.
-#' \emph{Bit Numerical Mathematics}, \bold{47} (2), 441-453.
+#' \emph{BIT Numerical Mathematics}, \bold{47} (2), 441-453.
 #' @docType package
 #' @name polyCub-package
 #' @seealso The packages \pkg{cubature} and \pkg{R2Cuba}, which are more
diff --git a/README.md b/README.md
index c1f2732..94ae03d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-polyCub [`@CRAN`](https://CRAN.R-project.org/package=polyCub)
-============================================================
+The R package polyCub ([CRAN](https://CRAN.R-project.org/package=polyCub))
+=====================
 
-An `R` package providing methods for **cubature** (numerical integration) **over
+An R package providing methods for **cubature** (numerical integration) **over
 polygonal domains**. Note that for cubature over simple hypercubes, the packages
 [`cubature`](https://CRAN.R-project.org/package=cubature)
 and [`R2Cuba`](https://CRAN.R-project.org/package=R2Cuba)
@@ -13,14 +13,14 @@ wrapper around the following specific cubature methods.
 
 #### General-purpose cubature rules:
 * `polyCub.midpoint()`: Two-dimensional midpoint rule (a simple wrapper around
-  `spatstat::as.im.function`) 
+  [`spatstat`](https://CRAN.R-project.org/package=spatstat)'s `as.im.function()`)
 * `polyCub.SV()`: Product Gauss cubature as proposed by
-  [Sommariva and Vianello (2007, *Bit Numerical Mathematics*,
-  **47** (2), 441-453)](http://dx.doi.org/10.1007/s10543-007-0131-2)
+  [Sommariva and Vianello (2007, *BIT Numerical Mathematics*)](https://doi.org/10.1007/s10543-007-0131-2)
 
 #### Cubature rules for specific types of functions:
 * `polyCub.iso()`: Efficient adaptive cubature for *isotropic* functions via
-  line `integrate()` along the polygon boundary
+  line `integrate()` along the polygon boundary, as described in Supplement B of
+  [Meyer and Held (2014, *The Annals of Applied Statistics*)](https://doi.org/10.1214/14-AOAS743)
 * `polyCub.exact.Gauss()` and `circleCub.Gauss()`:
   Quasi-exact methods specific to the integration of the
   *bivariate Gaussian density* over polygonal and circular domains, respectively
@@ -28,9 +28,26 @@ wrapper around the following specific cubature methods.
 
 A Short History of the Package
 ------------------------------
-For any spatio-temporal point process model, the likelihood contains an integral of the conditional intensity function over the observation region. If this is a polygon, analytical solutions are only available for trivial cases of the intensity function -- thus the need of a cubature method over polygonal domains.
 
-My Master's Thesis (2010) on ["Spatio-Temporal Infectious Disease Epidemiology based on Point Processes"](http://epub.ub.uni-muenchen.de/11703/) is the origin of this package. Section 3.2 therein offers a more detailed description and benchmark experiment of some of the above cubature methods (and others).
-
-The implementation then went into the [`surveillance`](https://CRAN.R-project.org/package=surveillance) package, where it is used to fit `twinstim()`, self-exciting two-component spatio-temporal point process models, described in [Meyer et al (2012, *Biometrics*, **68** (2), 607-616)](http://dx.doi.org/10.1111/j.1541-0420.2011.01684.x).
-In May 2013, I decided to move the cubature functionality into a stand-alone package, since it might be useful for other projects as well. Subsequently, the isotropic cubature method `polyCub.iso()` was developed to efficiently estimate point process models with a power-law distance decay of interaction ([Meyer and Held, 2014, *The Annals of Applied Statistics*, **8** (3), 1612-1639](http://dx.doi.org/10.1214/14-AOAS743)).
+For any spatio-temporal point process model, the likelihood contains an integral
+of the conditional intensity function over the observation region. If this is a
+polygon, analytical solutions are only available for trivial cases of the
+intensity function - thus the need of a cubature method over polygonal domains.
+
+My Master's Thesis (2010) on
+["Spatio-Temporal Infectious Disease Epidemiology based on Point Processes"](http://epub.ub.uni-muenchen.de/11703/)
+is the origin of this package. Section 3.2 therein offers a more detailed
+description and benchmark experiment of some of the above cubature methods (and
+others).
+
+The implementation then went into the
+[`surveillance`](https://CRAN.R-project.org/package=surveillance) package, where
+it is used to fit `twinstim()`, self-exciting two-component spatio-temporal
+point process models, described in
+[Meyer et al (2012, *Biometrics*)](https://doi.org/10.1111/j.1541-0420.2011.01684.x).
+In May 2013, I decided to move the cubature functionality into a stand-alone
+package, since it might be useful for other projects as well.
+Subsequently, I developed the isotropic cubature method `polyCub.iso()` to
+efficiently estimate point process models with a power-law distance decay of
+interaction
+([Meyer and Held, 2014, *The Annals of Applied Statistics*](https://doi.org/10.1214/14-AOAS743)).
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 4157db5..ea92fa8 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -8,6 +8,26 @@
 \title{News for Package 'polyCub'}
 
 
+\section{Changes in polyCub version 0.6.1 (2017-10-02)}{
+
+  \itemize{
+    \item The exported C-function \code{polyCub_iso()} \dots
+    \itemize{
+      \item did not handle its \code{stop_on_error} argument correctly
+      (it would always stop on error).
+      \item now detects non-finite \code{intrfr} function values
+      and gives an informative error message (rather than just reporting
+      \dQuote{abnormal termination of integration routine}).
+    }
+
+    \item Package \pkg{polyCub} no longer strictly depends on package
+    \CRANpkg{spatstat}, which is only required for \code{polyCub.midpoint()}.
+  }
+
+}
+
+
+
 \section{Changes in polyCub version 0.6.0 (2017-05-24)}{
 
   \itemize{
diff --git a/inst/examples/plotpolyf.R b/inst/examples/plotpolyf.R
index 0946438..6001549 100644
--- a/inst/examples/plotpolyf.R
+++ b/inst/examples/plotpolyf.R
@@ -1,11 +1,18 @@
-### a polygonal domain
-data("letterR", package="spatstat")
+### a polygonal domain (a rounded version of spatstat.data::letterR$bdry)
+letterR <- list(
+    list(x = c(3.9, 3.8, 3.7, 3.5, 3.4, 3.5, 3.7, 3.8, 3.8, 3.7,
+               3.7, 3.5, 3.3, 2, 2, 2.7, 2.7, 2.9, 3, 3.3, 3.9),
+         y = c(0.7, 1.1, 1.3, 1.7, 1.8, 1.9, 2.1, 2.3, 2.5, 2.8, 3,
+               3.2, 3.3, 3.3, 0.7, 0.7, 1.7, 1.7, 1.5, 0.7, 0.6)),
+    list(x = c(2.6, 2.6, 3, 3.1, 3.2, 3.1, 3.1, 3),
+         y = c(2.2, 2.7, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2))
+)
 
 ### f: isotropic exponential decay
-fr <- function(r, rate=1) dexp(r, rate=rate)
+fr <- function(r, rate = 1) dexp(r, rate = rate)
 fcenter <- c(2,3)
-f <- function (s, rate=1) fr(sqrt(rowSums(t(t(s)-fcenter)^2)), rate=rate)
+f <- function (s, rate = 1) fr(sqrt(rowSums(t(t(s)-fcenter)^2)), rate = rate)
 
 ### plot
-plotpolyf(letterR, f, use.lattice=FALSE)
-plotpolyf(letterR, f, use.lattice=TRUE)
+plotpolyf(letterR, f, use.lattice = FALSE)
+plotpolyf(letterR, f, use.lattice = TRUE)
diff --git a/inst/examples/polyCub.R b/inst/examples/polyCub.R
index 2a9b564..c3b2cdc 100644
--- a/inst/examples/polyCub.R
+++ b/inst/examples/polyCub.R
@@ -4,21 +4,21 @@
 f <- function (s, sigma = 5) exp(-rowSums(s^2)/2/sigma^2) / (2*pi*sigma^2)
 
 ## simple polygonal integration domain
-disc.owin <- spatstat::disc(radius=5, centre=c(3,2), npoly=8)
+octagon <- spatstat::disc(radius = 5, centre = c(3,2), npoly = 8)
 
 ## plot image of the function and integration domain
-plotpolyf(disc.owin, f, xlim=c(-8,8), ylim=c(-8,8))
+plotpolyf(octagon, f, xlim=c(-8,8), ylim=c(-8,8))
 
 
 ### Two-dimensional midpoint rule
 
 testmidpoint <- function (eps, main=paste("2D midpoint rule with eps =",eps))
 {
-    plotpolyf(disc.owin, f, xlim=c(-8,8), ylim=c(-8,8), use.lattice=FALSE)    
+    plotpolyf(octagon, f, xlim=c(-8,8), ylim=c(-8,8), use.lattice=FALSE)
     ## add evaluation points to plot
-    with(spatstat::as.mask(disc.owin, eps=eps),
+    with(spatstat::as.mask(octagon, eps=eps),
          points(expand.grid(xcol, yrow), col=m, pch=20))
-    polyCub.midpoint(disc.owin, f, eps=eps)
+    polyCub.midpoint(octagon, f, eps=eps)
 }
 testmidpoint(5)
 testmidpoint(3)
@@ -30,26 +30,26 @@ testmidpoint(0.2)
 
 for (nGQ in c(1:5,10,20,60)) {
     cat("nGQ =", sprintf("%2i",nGQ), ": ",
-        format(polyCub.SV(disc.owin, f, nGQ=nGQ), digits=16),
+        format(polyCub.SV(octagon, f, nGQ=nGQ), digits=16),
         "\n")
 }
 
 ## 'rotation' affects location of nodes
 opar <- par(mfrow=c(1,2))
-polyCub.SV(disc.owin, f, nGQ=2, rotation=FALSE, plot=TRUE)
-polyCub.SV(disc.owin, f, nGQ=2, rotation=TRUE, plot=TRUE)
+polyCub.SV(octagon, f, nGQ=2, rotation=FALSE, plot=TRUE)
+polyCub.SV(octagon, f, nGQ=2, rotation=TRUE, plot=TRUE)
 par(opar)
 
 
 ### Line integration along the boundary for isotropic functions
 
-polyCub.iso(disc.owin, f, center=c(0,0))   # see ?polyCub.iso
+polyCub.iso(octagon, f, center=c(0,0))   # see ?polyCub.iso
 
 
 ### Quasi-exact cubature of the bivariate Gaussian density
 ### using gpclib::tristrip and mvtnorm::pmvnorm()
 
 if (requireNamespace("mvtnorm") && gpclibPermit()) {
-    print(polyCub.exact.Gauss(disc.owin, mean=c(0,0), Sigma=5^2*diag(2),
+    print(polyCub.exact.Gauss(octagon, mean=c(0,0), Sigma=5^2*diag(2),
                               plot=TRUE), digits=16)
 }
diff --git a/inst/examples/polyCub.iso.R b/inst/examples/polyCub.iso.R
index 506bb2a..8aab024 100644
--- a/inst/examples/polyCub.iso.R
+++ b/inst/examples/polyCub.iso.R
@@ -2,21 +2,22 @@
 example(plotpolyf)
 
 ## numerical approximation of 'intrfr'
-(intISOnum <- polyCub.iso(letterR, f, center=fcenter))
+(intISOnum <- polyCub.iso(letterR, f, center = fcenter))
 
-## analytical 'intrfr' (recall: f_r(r)=dexp(r), we need int_0^R r*f(r) dr)
-intrfr <- function (R, rate=1) pgamma(R, 2, rate) / rate
-(intISOana <- polyCub.iso(letterR, intrfr=intrfr, center=fcenter))
+## analytical 'intrfr'
+## intrfr(R) = int_0^R r*f(r) dr, for f(r) = dexp(r), gives
+intrfr <- function (R, rate = 1) pgamma(R, 2, rate) / rate
+(intISOana <- polyCub.iso(letterR, intrfr = intrfr, center = fcenter))
 
-stopifnot(all.equal(intISOana, intISOnum, check.attributes=FALSE))
+stopifnot(all.equal(intISOana, intISOnum, check.attributes = FALSE))
 
 
 ### polygon area: f(r) = 1, f(x,y) = 1, center does not really matter
 
+## intrfr(R) = int_0^R r*f(r) dr = int_0^R r dr = R^2/2
 intrfr.const <- function (R) R^2/2
-(area.ISO <- polyCub.iso(letterR, intrfr=intrfr.const, center=c(0,0)))
+(area.ISO <- polyCub.iso(letterR, intrfr = intrfr.const, center = c(0,0)))
 
-stopifnot(all.equal(spatstat::area.owin(letterR),
-                    area.ISO,
-                    check.attributes=FALSE))
+stopifnot(all.equal(spatstat::area.owin(spatstat::owin(poly = letterR)),
+                    area.ISO, check.attributes = FALSE))
 ## the hole is subtracted correctly
diff --git a/inst/include/polyCubAPI.h b/inst/include/polyCubAPI.h
index fa4061e..9286079 100644
--- a/inst/include/polyCubAPI.h
+++ b/inst/include/polyCubAPI.h
@@ -5,7 +5,7 @@
  *
  * This file is part of the R package "polyCub",
  * free software under the terms of the GNU General Public License, version 2,
- * a copy of which is available at http://www.R-project.org/Licenses/.
+ * a copy of which is available at https://www.R-project.org/Licenses/.
  ******************************************************************************/
 
 #include <stdlib.h>         // NULL
diff --git a/man/circleCub.Gauss.Rd b/man/circleCub.Gauss.Rd
index 152fb89..47517cd 100644
--- a/man/circleCub.Gauss.Rd
+++ b/man/circleCub.Gauss.Rd
@@ -29,7 +29,7 @@ distribution (\code{pchisq}), cp. Formula 26.3.24 in Abramowitz and Stegun
 }
 \note{
 The non-centrality parameter of the evaluated chi-squared distribution
-equals the squared distance between the \code{mean} and the 
+equals the squared distance between the \code{mean} and the
 \code{center}. If this becomes too large, the result becomes inaccurate, see
 \code{\link{pchisq}}.
 }
diff --git a/man/coerce-gpc-methods.Rd b/man/coerce-gpc-methods.Rd
index 74ae597..4b4ab1e 100644
--- a/man/coerce-gpc-methods.Rd
+++ b/man/coerce-gpc-methods.Rd
@@ -11,13 +11,13 @@ owin2gpc(object)
 
 gpc2owin(object, ...)
 
-\method{as.owin}{gpc.poly}(W, ...)
+as.owin.gpc.poly(W, ...)
 }
 \arguments{
 \item{object}{an object of class \code{"gpc.poly"} or \code{"owin"},
 respectively.}
 
-\item{...}{further arguments passed to \code{\link{owin}}.}
+\item{...}{further arguments passed to \code{\link[spatstat]{owin}}.}
 
 \item{W}{an object of class \code{"gpc.poly"}.}
 }
@@ -28,8 +28,8 @@ respectively. If neither package \pkg{rgeos} nor \pkg{gpclib} are available,
 \code{"gpc.poly"} (no formal class) with a warning.
 }
 \description{
-Package \pkg{polyCub} implements converters between the classes 
-\code{"\link[=owin.object]{owin}"} of package \pkg{spatstat} and
+Package \pkg{polyCub} implements converters between the classes
+\code{"\link[spatstat:owin.object]{owin}"} of package \pkg{spatstat} and
 \code{"\link[rgeos:gpc.poly-class]{gpc.poly}"} of package \pkg{rgeos}
 (originally from \pkg{gpclib}).
 Support for the \code{"gpc.poly"} class was dropped from
diff --git a/man/coerce-sp-methods.Rd b/man/coerce-sp-methods.Rd
index 353b55f..e6c29e1 100644
--- a/man/coerce-sp-methods.Rd
+++ b/man/coerce-sp-methods.Rd
@@ -11,25 +11,27 @@
 \alias{coerce,Polygon,Polygons-method}
 \title{Coerce \code{"SpatialPolygons"} to \code{"owin"}}
 \usage{
-\method{as.owin}{SpatialPolygons}(W, ...)
+as.owin.SpatialPolygons(W, ...)
 
-\method{as.owin}{Polygons}(W, ...)
+as.owin.Polygons(W, ...)
 
-\method{as.owin}{Polygon}(W, ...)
+as.owin.Polygon(W, ...)
 }
 \arguments{
 \item{W}{an object of class \code{"SpatialPolygons"},
 \code{"Polygons"}, or \code{"Polygon"}.}
 
-\item{...}{further arguments passed to \code{\link{owin}}.}
+\item{...}{further arguments passed to \code{\link[spatstat]{owin}}.}
 }
 \description{
 Package \pkg{polyCub} implements \code{coerce}-methods
 (\code{as(object, Class)}) to convert \code{"\linkS4class{SpatialPolygons}"}
 (or \code{"\linkS4class{Polygons}"} or \code{"\linkS4class{Polygon}"})
-to \code{"\link[=owin.object]{owin}"}.
-They are also registered as \code{\link{as.owin}}-methods to support
-\code{\link{polyCub.midpoint}}.
+to \code{"\link[spatstat:owin.object]{owin}"}.
+They are also available as \code{as.owin.*} functions to support
+\code{\link{polyCub.midpoint}}. However, these are no registered S3 methods
+for \code{\link[spatstat]{as.owin}}, since package \pkg{spatstat} is
+optional.
 Note that the \pkg{maptools} package contains an alternative implementation
 of coercion from \code{"SpatialPolygons"} to \code{"owin"} (and reverse),
 and \R will use the S4 \code{coerce}-method that was loaded last,
diff --git a/man/plotpolyf.Rd b/man/plotpolyf.Rd
index 6c708f2..029a8ad 100644
--- a/man/plotpolyf.Rd
+++ b/man/plotpolyf.Rd
@@ -40,8 +40,8 @@ The range of function values will be divided into \code{cuts+1} levels.}
 (\code{\link[lattice]{levelplot}}) should be used.}
 
 \item{print.args}{a list of arguments passed to \code{\link{print.trellis}}
-for plotting the produced \code{\link[=trellis.object]{"trellis"}} object
-(given \code{use.lattice = TRUE}). The latter will be returned without 
+for plotting the produced \code{\link[lattice:trellis.object]{"trellis"}} object
+(given \code{use.lattice = TRUE}). The latter will be returned without
 explicit \code{print}ing if \code{print.args} is not a list.}
 }
 \description{
@@ -50,17 +50,24 @@ function, using either \code{\link[lattice:levelplot]{lattice::levelplot}}
 or \code{\link{image}}.
 }
 \examples{
-### a polygonal domain
-data("letterR", package="spatstat")
+### a polygonal domain (a rounded version of spatstat.data::letterR$bdry)
+letterR <- list(
+    list(x = c(3.9, 3.8, 3.7, 3.5, 3.4, 3.5, 3.7, 3.8, 3.8, 3.7,
+               3.7, 3.5, 3.3, 2, 2, 2.7, 2.7, 2.9, 3, 3.3, 3.9),
+         y = c(0.7, 1.1, 1.3, 1.7, 1.8, 1.9, 2.1, 2.3, 2.5, 2.8, 3,
+               3.2, 3.3, 3.3, 0.7, 0.7, 1.7, 1.7, 1.5, 0.7, 0.6)),
+    list(x = c(2.6, 2.6, 3, 3.1, 3.2, 3.1, 3.1, 3),
+         y = c(2.2, 2.7, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2))
+)
 
 ### f: isotropic exponential decay
-fr <- function(r, rate=1) dexp(r, rate=rate)
+fr <- function(r, rate = 1) dexp(r, rate = rate)
 fcenter <- c(2,3)
-f <- function (s, rate=1) fr(sqrt(rowSums(t(t(s)-fcenter)^2)), rate=rate)
+f <- function (s, rate = 1) fr(sqrt(rowSums(t(t(s)-fcenter)^2)), rate = rate)
 
 ### plot
-plotpolyf(letterR, f, use.lattice=FALSE)
-plotpolyf(letterR, f, use.lattice=TRUE)
+plotpolyf(letterR, f, use.lattice = FALSE)
+plotpolyf(letterR, f, use.lattice = TRUE)
 }
 \author{
 Sebastian Meyer
diff --git a/man/polyCub-package.Rd b/man/polyCub-package.Rd
index 6d3ec7f..ad4d411 100644
--- a/man/polyCub-package.Rd
+++ b/man/polyCub-package.Rd
@@ -7,7 +7,7 @@
 \description{
 The \R package \pkg{polyCub} provides methods for \strong{cubature}
 (numerical integration) \strong{over polygonal domains}.
-The function \code{\link{polyCub}()} is the main entry point of the package. 
+The function \code{\link{polyCub}()} is the main entry point of the package.
 It is a wrapper around the specific cubature methods listed below.
 }
 \details{
@@ -60,12 +60,12 @@ Available as \url{http://epub.ub.uni-muenchen.de/11703/}.
 Meyer, S. and Held, L. (2014).
 Power-law models for infectious disease spread.
 \emph{The Annals of Applied Statistics}, \bold{8} (3), 1612-1639.\cr
-DOI-Link: \url{http://dx.doi.org/10.1214/14-AOAS743},
-\href{http://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
+DOI-Link: \url{https://doi.org/10.1214/14-AOAS743},
+\href{https://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
 
 Sommariva, A. and Vianello, M. (2007).
 Product Gauss cubature over polygons based on Green's integration formula.
-\emph{Bit Numerical Mathematics}, \bold{47} (2), 441-453.
+\emph{BIT Numerical Mathematics}, \bold{47} (2), 441-453.
 }
 \seealso{
 The packages \pkg{cubature} and \pkg{R2Cuba}, which are more
diff --git a/man/polyCub.Rd b/man/polyCub.Rd
index 7dcb6f5..0ef3baf 100644
--- a/man/polyCub.Rd
+++ b/man/polyCub.Rd
@@ -44,21 +44,21 @@ argument.
 f <- function (s, sigma = 5) exp(-rowSums(s^2)/2/sigma^2) / (2*pi*sigma^2)
 
 ## simple polygonal integration domain
-disc.owin <- spatstat::disc(radius=5, centre=c(3,2), npoly=8)
+octagon <- spatstat::disc(radius = 5, centre = c(3,2), npoly = 8)
 
 ## plot image of the function and integration domain
-plotpolyf(disc.owin, f, xlim=c(-8,8), ylim=c(-8,8))
+plotpolyf(octagon, f, xlim=c(-8,8), ylim=c(-8,8))
 
 
 ### Two-dimensional midpoint rule
 
 testmidpoint <- function (eps, main=paste("2D midpoint rule with eps =",eps))
 {
-    plotpolyf(disc.owin, f, xlim=c(-8,8), ylim=c(-8,8), use.lattice=FALSE)    
+    plotpolyf(octagon, f, xlim=c(-8,8), ylim=c(-8,8), use.lattice=FALSE)
     ## add evaluation points to plot
-    with(spatstat::as.mask(disc.owin, eps=eps),
+    with(spatstat::as.mask(octagon, eps=eps),
          points(expand.grid(xcol, yrow), col=m, pch=20))
-    polyCub.midpoint(disc.owin, f, eps=eps)
+    polyCub.midpoint(octagon, f, eps=eps)
 }
 testmidpoint(5)
 testmidpoint(3)
@@ -70,27 +70,27 @@ testmidpoint(0.2)
 
 for (nGQ in c(1:5,10,20,60)) {
     cat("nGQ =", sprintf("\%2i",nGQ), ": ",
-        format(polyCub.SV(disc.owin, f, nGQ=nGQ), digits=16),
+        format(polyCub.SV(octagon, f, nGQ=nGQ), digits=16),
         "\\n")
 }
 
 ## 'rotation' affects location of nodes
 opar <- par(mfrow=c(1,2))
-polyCub.SV(disc.owin, f, nGQ=2, rotation=FALSE, plot=TRUE)
-polyCub.SV(disc.owin, f, nGQ=2, rotation=TRUE, plot=TRUE)
+polyCub.SV(octagon, f, nGQ=2, rotation=FALSE, plot=TRUE)
+polyCub.SV(octagon, f, nGQ=2, rotation=TRUE, plot=TRUE)
 par(opar)
 
 
 ### Line integration along the boundary for isotropic functions
 
-polyCub.iso(disc.owin, f, center=c(0,0))   # see ?polyCub.iso
+polyCub.iso(octagon, f, center=c(0,0))   # see ?polyCub.iso
 
 
 ### Quasi-exact cubature of the bivariate Gaussian density
 ### using gpclib::tristrip and mvtnorm::pmvnorm()
 
 if (requireNamespace("mvtnorm") && gpclibPermit()) {
-    print(polyCub.exact.Gauss(disc.owin, mean=c(0,0), Sigma=5^2*diag(2),
+    print(polyCub.exact.Gauss(octagon, mean=c(0,0), Sigma=5^2*diag(2),
                               plot=TRUE), digits=16)
 }
 }
diff --git a/man/polyCub.SV.Rd b/man/polyCub.SV.Rd
index eae708b..f0f0238 100644
--- a/man/polyCub.SV.Rd
+++ b/man/polyCub.SV.Rd
@@ -44,14 +44,14 @@ convex polygons, this rotation guarantees that all nodes fall inside the
 polygon.}
 
 \item{engine}{character string specifying the implementation to use.
-Up to \pkg{polyCub} version 0.4-3, the two-dimensional nodes and weights 
+Up to \pkg{polyCub} version 0.4-3, the two-dimensional nodes and weights
 were computed by \R functions and these are still available by setting
 \code{engine = "R"}.
-The new C-implementation is now the default (\code{engine = "C"}) and 
+The new C-implementation is now the default (\code{engine = "C"}) and
 requires approximately 30\% less computation time.\cr
 The special setting \code{engine = "C+reduce"} will discard redundant nodes
 at (0,0) with zero weight resulting from edges on the base-line
-\eqn{x = \alpha} or orthogonal to it. 
+\eqn{x = \alpha} or orthogonal to it.
 This extra cleaning is only worth its cost for computationally intensive
 functions \code{f} over polygons which really have some edges on the
 baseline or parallel to the x-axis.  Note that the old \R
@@ -79,7 +79,7 @@ Sommariva and Vianello (2007).
 \references{
 Sommariva, A. and Vianello, M. (2007).
 Product Gauss cubature over polygons based on Green's integration formula.
-\emph{Bit Numerical Mathematics}, \bold{47} (2), 441-453.
+\emph{BIT Numerical Mathematics}, \bold{47} (2), 441-453.
 }
 \seealso{
 Other polyCub-methods: \code{\link{polyCub.exact.Gauss}},
diff --git a/man/polyCub.exact.Gauss.Rd b/man/polyCub.exact.Gauss.Rd
index 7d2242b..b245629 100644
--- a/man/polyCub.exact.Gauss.Rd
+++ b/man/polyCub.exact.Gauss.Rd
@@ -24,7 +24,7 @@ transformed (shifted and scaled).}
 The integral of the bivariate normal density over \code{polyregion}.
 Two attributes are appended to the integral value:
 \item{nEval}{
-number of triangles over which the standard bivariate normal density had to 
+number of triangles over which the standard bivariate normal density had to
 be integrated, i.e. number of calls to \code{\link[mvtnorm]{pmvnorm}} and
 \code{\link[stats]{pnorm}}, the former of which being the most time-consuming
 operation.
@@ -38,22 +38,23 @@ quasi-exact (as is the \code{pmvnorm} function).
 }
 \description{
 Integration is based on triangulation of the (transformed) polygonal domain
-and formulae from the 
+and formulae from the
 Abramowitz and Stegun (1972) handbook (Section 26.9, Example 9, pp. 956f.).
 This method is quite cumbersome because the A&S formula is only for triangles
 where one vertex is the origin (0,0). For each triangle of the
-\code{\link[gpclib]{tristrip}} we have to check in which of the 6 outer 
-regions of the triangle the origin (0,0) lies and adapt the signs in the 
+\code{\link[gpclib]{tristrip}} we have to check in which of the 6 outer
+regions of the triangle the origin (0,0) lies and adapt the signs in the
 formula appropriately: \eqn{(AOB+BOC-AOC)} or \eqn{(AOB-AOC-BOC)} or
 \eqn{(AOB+AOC-BOC)} or \eqn{(AOC+BOC-AOB)} or \ldots.
 However, the most time consuming step is the
 evaluation of \code{\link[mvtnorm]{pmvnorm}}.
 }
 \note{
-The package \pkg{gpclib} (which is required to produce the
-\code{tristrip}, since this is not yet implemented in \pkg{rgeos})
-has a restricted license (commercial use prohibited).
-It has to be accepted explicitly via
+The package \pkg{gpclib} is required to produce the
+\code{tristrip}, since this is not implemented in \pkg{rgeos}
+(as of version 0.3-25).
+The restricted license of \pkg{gpclib} (commercial use prohibited)
+has to be accepted explicitly via
 \code{\link{gpclibPermit}()} prior to using \code{polyCub.exact.Gauss}.
 }
 \examples{
diff --git a/man/polyCub.iso.Rd b/man/polyCub.iso.Rd
index 88d9577..cec1040 100644
--- a/man/polyCub.iso.Rd
+++ b/man/polyCub.iso.Rd
@@ -81,23 +81,24 @@ details.
 example(plotpolyf)
 
 ## numerical approximation of 'intrfr'
-(intISOnum <- polyCub.iso(letterR, f, center=fcenter))
+(intISOnum <- polyCub.iso(letterR, f, center = fcenter))
 
-## analytical 'intrfr' (recall: f_r(r)=dexp(r), we need int_0^R r*f(r) dr)
-intrfr <- function (R, rate=1) pgamma(R, 2, rate) / rate
-(intISOana <- polyCub.iso(letterR, intrfr=intrfr, center=fcenter))
+## analytical 'intrfr'
+## intrfr(R) = int_0^R r*f(r) dr, for f(r) = dexp(r), gives
+intrfr <- function (R, rate = 1) pgamma(R, 2, rate) / rate
+(intISOana <- polyCub.iso(letterR, intrfr = intrfr, center = fcenter))
 
-stopifnot(all.equal(intISOana, intISOnum, check.attributes=FALSE))
+stopifnot(all.equal(intISOana, intISOnum, check.attributes = FALSE))
 
 
 ### polygon area: f(r) = 1, f(x,y) = 1, center does not really matter
 
+## intrfr(R) = int_0^R r*f(r) dr = int_0^R r dr = R^2/2
 intrfr.const <- function (R) R^2/2
-(area.ISO <- polyCub.iso(letterR, intrfr=intrfr.const, center=c(0,0)))
+(area.ISO <- polyCub.iso(letterR, intrfr = intrfr.const, center = c(0,0)))
 
-stopifnot(all.equal(spatstat::area.owin(letterR),
-                    area.ISO,
-                    check.attributes=FALSE))
+stopifnot(all.equal(spatstat::area.owin(spatstat::owin(poly = letterR)),
+                    area.ISO, check.attributes = FALSE))
 ## the hole is subtracted correctly
 }
 \references{
@@ -107,8 +108,8 @@ Space-Time Modeling and Inference (May 2013, Aalborg, Denmark).
 Meyer, S. and Held, L. (2014).
 Power-law models for infectious disease spread.
 \emph{The Annals of Applied Statistics}, \bold{8} (3), 1612-1639.\cr
-DOI-Link: \url{http://dx.doi.org/10.1214/14-AOAS743},
-\href{http://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
+DOI-Link: \url{https://doi.org/10.1214/14-AOAS743},
+\href{https://arxiv.org/abs/1308.5115}{arXiv:1308.5115}
 }
 \seealso{
 \code{system.file("include", "polyCubAPI.h", package = "polyCub")}
diff --git a/man/polygauss.Rd b/man/polygauss.Rd
index f772be9..d9337a8 100644
--- a/man/polygauss.Rd
+++ b/man/polygauss.Rd
@@ -32,14 +32,14 @@ convex polygons, this rotation guarantees that all nodes fall inside the
 polygon.}
 
 \item{engine}{character string specifying the implementation to use.
-Up to \pkg{polyCub} version 0.4-3, the two-dimensional nodes and weights 
+Up to \pkg{polyCub} version 0.4-3, the two-dimensional nodes and weights
 were computed by \R functions and these are still available by setting
 \code{engine = "R"}.
-The new C-implementation is now the default (\code{engine = "C"}) and 
+The new C-implementation is now the default (\code{engine = "C"}) and
 requires approximately 30\% less computation time.\cr
 The special setting \code{engine = "C+reduce"} will discard redundant nodes
 at (0,0) with zero weight resulting from edges on the base-line
-\eqn{x = \alpha} or orthogonal to it. 
+\eqn{x = \alpha} or orthogonal to it.
 This extra cleaning is only worth its cost for computationally intensive
 functions \code{f} over polygons which really have some edges on the
 baseline or parallel to the x-axis.  Note that the old \R
@@ -51,6 +51,6 @@ Calculate 2D Nodes and Weights of the Product Gauss Cubature
 \references{
 Sommariva, A. and Vianello, M. (2007):
 Product Gauss cubature over polygons based on Green's integration formula.
-\emph{Bit Numerical Mathematics}, \bold{47} (2), 441-453.
+\emph{BIT Numerical Mathematics}, \bold{47} (2), 441-453.
 }
 \keyword{internal}
diff --git a/man/xylist.Rd b/man/xylist.Rd
index 113eef9..d379da0 100644
--- a/man/xylist.Rd
+++ b/man/xylist.Rd
@@ -51,7 +51,7 @@ polygons by their core feature only, a list of lists of vertex coordinates
 The generic function \code{xylist} can deal with the
 following polygon classes:
 \itemize{
-\item{\code{"\link[=owin.object]{owin}"} from package \pkg{spatstat}}
+\item{\code{"\link[spatstat:owin.object]{owin}"} from package \pkg{spatstat}}
 \item{\code{"\link[rgeos:gpc.poly-class]{gpc.poly}"} from package
 \pkg{rgeos} (or \pkg{gpclib})}
 \item{\code{"\linkS4class{Polygons}"} from package \pkg{sp}
diff --git a/src/init.c b/src/init.c
index f07dbb1..4fe4230 100644
--- a/src/init.c
+++ b/src/init.c
@@ -5,7 +5,7 @@
  *
  * This file is part of the R package "polyCub",
  * free software under the terms of the GNU General Public License, version 2,
- * a copy of which is available at http://www.R-project.org/Licenses/.
+ * a copy of which is available at https://www.R-project.org/Licenses/.
  ******************************************************************************/
 
 #include <stdlib.h> // for NULL
diff --git a/src/polyCub.SV.c b/src/polyCub.SV.c
index 7171460..3885ffe 100644
--- a/src/polyCub.SV.c
+++ b/src/polyCub.SV.c
@@ -5,7 +5,7 @@
  *
  * This file is part of the R package "polyCub",
  * free software under the terms of the GNU General Public License, version 2,
- * a copy of which is available at http://www.R-project.org/Licenses/.
+ * a copy of which is available at https://www.R-project.org/Licenses/.
  ******************************************************************************/
 
 #include "polyCub.SV.h"
diff --git a/src/polyCub.SV.h b/src/polyCub.SV.h
index b708843..a24add1 100644
--- a/src/polyCub.SV.h
+++ b/src/polyCub.SV.h
@@ -5,7 +5,7 @@
  *
  * This file is part of the R package "polyCub",
  * free software under the terms of the GNU General Public License, version 2,
- * a copy of which is available at http://www.R-project.org/Licenses/.
+ * a copy of which is available at https://www.R-project.org/Licenses/.
  ******************************************************************************/
 
 void C_polygauss(
diff --git a/src/polyCub.iso.c b/src/polyCub.iso.c
index e71bc28..dba4b45 100644
--- a/src/polyCub.iso.c
+++ b/src/polyCub.iso.c
@@ -5,7 +5,7 @@
  *
  * This file is part of the R package "polyCub",
  * free software under the terms of the GNU General Public License, version 2,
- * a copy of which is available at http://www.R-project.org/Licenses/.
+ * a copy of which is available at https://www.R-project.org/Licenses/.
  ******************************************************************************/
 
 /* The corresponding math is derived in Supplement B (Section 2.4) of
@@ -14,9 +14,10 @@
  * https://doi.org/10.1214/14-AOAS743SUPPB
  */
 
-#include <math.h>
-#include <R_ext/Print.h>   // Rprintf
+#include <R_ext/Arith.h>   // R_FINITE, otherwise math.h would suffice
+#include <R_ext/Error.h>   // error
 #include <R_ext/Memory.h>  // R_alloc
+#include <R_ext/Print.h>   // Rprintf
 #include <R_ext/Applic.h>  // Rdqags
 
 // header file defines the intrfr_fn type
@@ -35,6 +36,8 @@ static double lineIntegrand(
     double norm2 = px*px + py*py;
     // evaluate F(R) = int_0^R r*f(r) dr at R=||(px,py)||
     double inti = intrfr(sqrt(norm2), pars);
+    if (!R_FINITE(inti))
+        error("non-finite intrfr value at R=%f", sqrt(norm2));
     return num*inti/norm2;
 }
 
@@ -126,7 +129,7 @@ void polyiso(
                      *subdivisions, epsabs, epsrel,
                      &resulti, &abserri, &nevali, &ieri);
         if (ieri > 0) {
-            if (stop_on_error == 0) {
+            if (*stop_on_error == 0) {
                 Rprintf("abnormal termination of integration routine (%i)\n", ieri);
             } else {
                 error("abnormal termination of integration routine (%i)\n", ieri);
diff --git a/src/polyCub.iso.h b/src/polyCub.iso.h
index 5e83953..fd4fbbd 100644
--- a/src/polyCub.iso.h
+++ b/src/polyCub.iso.h
@@ -5,7 +5,7 @@
  *
  * This file is part of the R package "polyCub",
  * free software under the terms of the GNU General Public License, version 2,
- * a copy of which is available at http://www.R-project.org/Licenses/.
+ * a copy of which is available at https://www.R-project.org/Licenses/.
  ******************************************************************************/
 
 typedef double (*intrfr_fn) (double, double*);
diff --git a/tests/testthat/polyiso_powerlaw.c b/tests/testthat/polyiso_powerlaw.c
index f1cf8b3..47cb5b8 100644
--- a/tests/testthat/polyiso_powerlaw.c
+++ b/tests/testthat/polyiso_powerlaw.c
@@ -5,7 +5,7 @@
  *
  * This file is part of the R package "polyCub",
  * free software under the terms of the GNU General Public License, version 2,
- * a copy of which is available at http://www.R-project.org/Licenses/.
+ * a copy of which is available at https://www.R-project.org/Licenses/.
  ******************************************************************************/
 
 #include <math.h>
diff --git a/tests/testthat/test-regression.R b/tests/testthat/test-regression.R
index 70f68a2..4c98fcc 100644
--- a/tests/testthat/test-regression.R
+++ b/tests/testthat/test-regression.R
@@ -1,12 +1,14 @@
 context("Regression tests")
 
+octagon <- spatstat::disc(radius = 5, centre = c(3,2), npoly = 8)
+f <- function (s) (rowSums(s^2)+1)^-2
+##plotpolyf(octagon, f)
+
 test_that("isotropic cubature can handle control list for integrate()", {
-    data("letterR", package="spatstat", envir=environment())
-    f <- function (s) (rowSums(s^2)+1)^-2
     ## previosly, passing control arguments did not work
-    int1 <- polyCub.iso(letterR, f, center=c(0,0), control=list(rel.tol=1e-3))
-    int2 <- polyCub.iso(letterR, f, center=c(0,0), control=list(rel.tol=1e-8))
-    ## results are almost identical
+    int1 <- polyCub.iso(octagon, f, center=c(0,0), control=list(rel.tol=1e-3))
+    int2 <- polyCub.iso(octagon, f, center=c(0,0), control=list(rel.tol=1e-8))
+    ## results are almost but not identical
     expect_equal(int1, int2, tolerance=1e-3)
     expect_false(identical(int1, int2))
 })

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-polycub.git



More information about the debian-science-commits mailing list