diff --git a/DESCRIPTION b/DESCRIPTION index 2627786..783a71f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: spatstat.geom -Version: 3.2-7.001 -Date: 2023-12-08 +Version: 3.2-7.002 +Date: 2023-12-16 Title: Geometrical Functionality of the 'spatstat' Family Authors@R: c(person("Adrian", "Baddeley", role = c("aut", "cre", "cph"), diff --git a/NEWS b/NEWS index 42fde28..7d74e88 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,15 @@ - CHANGES IN spatstat.geom VERSION 3.2-7.001 + CHANGES IN spatstat.geom VERSION 3.2-7.002 OVERVIEW - o Internal improvements. + o Minor improvements. + +SIGNIFICANT USER-VISIBLE CHANGES + + o is.subset.owin + Algorithm slightly modified to give better results when + the two polygons share some common edges. + CHANGES IN spatstat.geom VERSION 3.2-7 diff --git a/R/is.subset.owin.R b/R/is.subset.owin.R index 5d127ca..9833756 100644 --- a/R/is.subset.owin.R +++ b/R/is.subset.owin.R @@ -1,7 +1,7 @@ # # is.subset.owin.R # -# $Revision: 1.16 $ $Date: 2019/03/01 06:02:27 $ +# $Revision: 1.17 $ $Date: 2023/12/16 05:02:18 $ # # Determine whether a window is a subset of another window # @@ -52,17 +52,17 @@ is.subset.owin <- local({ return(FALSE) ## all vertices of A are inside B. if(is.convex(B)) return(TRUE) - ## check for boundary crossings - bx <- crossing.psp(edges(A), edges(B)) - if(npoints(bx) > 0) return(FALSE) - ## Absence of boundary crossings is sufficient if B has no holes - if(length(B$bdry) == 1 || !any(sapply(B$bdry, is.hole.xypolygon))) - return(TRUE) - ## Compare area of intersection with area of putative subset - ## (these are subject to numerical rounding error) - areaA <- area(A) - if(overlap.owin(A,B) >= areaA || - overlap.owin(B,A) >= areaA) return(TRUE) + ## check whether the boundaries are disjoint + if(!anycrossing.psp(edges(A), edges(B))) { + ## Disjoint boundary crossings sufficient if B has no holes + if(length(B$bdry) == 1 || !any(sapply(B$bdry, is.hole.xypolygon))) + return(TRUE) + ## Compare area of intersection with area of putative subset + ## (use '>=' instead of '==' because of numerical rounding error) + areaA <- area(A) + if(overlap.owin(A,B) >= areaA || + overlap.owin(B,A) >= areaA) return(TRUE) + } ## continue... } diff --git a/inst/doc/packagesizes.txt b/inst/doc/packagesizes.txt index ddd3f1a..ebdd9ab 100755 --- a/inst/doc/packagesizes.txt +++ b/inst/doc/packagesizes.txt @@ -24,4 +24,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines "2023-09-05" "3.2-5" 450 1203 0 35948 15822 "2023-10-19" "3.2-6" 451 1203 0 35983 15822 "2023-10-20" "3.2-7" 451 1203 0 35983 15822 -"2023-12-08" "3.2-7.001" 452 1203 0 36031 15822 +"2023-12-16" "3.2-7.002" 452 1203 0 36031 15822