Skip to content

Commit b668dc2

Browse files
committed
Ready for CRAN
1 parent 3200d91 commit b668dc2

5 files changed

Lines changed: 23 additions & 14 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: spatstat.utils
2-
Version: 3.2-2.006
3-
Date: 2026-05-07
2+
Version: 3.2-3
3+
Date: 2026-05-10
44
Title: Utility Functions for 'spatstat'
55
Authors@R: c(person("Adrian", "Baddeley",
66
role = c("aut", "cre"),

NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
CHANGES IN spatstat.utils VERSION 3.2-2.006
2+
CHANGES IN spatstat.utils VERSION 3.2-3
33

44
OVERVIEW
55

R/distppll.R

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#' distppll.R
33
#' (formerly 'xysegment.R')
44
#'
5-
#' $Revision: 1.24 $ $Date: 2026/05/07 05:08:01 $
5+
#' $Revision: 1.26 $ $Date: 2026/05/10 03:56:17 $
66
#'
77
#' Low level utilities for analytic geometry for line segments
88
#'
@@ -22,10 +22,11 @@
2222
#' distances from each of a list of points p[i,]
2323
#' to each of a list of line segments l[i,]
2424
#' [interpreted code uses large matrices and 'outer()']
25-
#' [Fortran implementation included!]
25+
#' [Partial C implementation included!]
2626
#'
2727
#' NNdist2segs
2828
#' distance to nearest line segment, from each point in a list.
29+
#' Efficient C code used.
2930
#'
3031
#' Copyright (c) Adrian Baddeley and Rob Foxall 1997-2026
3132
#' GNU Public Licence (>= 2.0)
@@ -51,10 +52,11 @@ distpl <- function(p, l) {
5152
si <- dy/leng
5253
#' back-rotated coords of p
5354
xpr <- co * xpl + si * ypl
54-
ypr <- - si * xpl + co * ypl
55-
#' test
56-
if(xpr >= 0 && xpr <= leng)
55+
## ypr <- - si * xpl + co * ypl
56+
if(xpr >= 0 && xpr <= leng) {
57+
ypr <- - si * xpl + co * ypl
5758
dmin <- min(dmin, abs(ypr))
59+
}
5860
return(dmin)
5961
}
6062

@@ -79,13 +81,14 @@ distppl <- function(p, l) {
7981
si <- dy/leng
8082
#' back-rotated coords of p
8183
xpr <- co * xpl + si * ypl
82-
ypr <- - si * xpl + co * ypl
84+
## ypr <- - si * xpl + co * ypl
8385
#' ypr is perpendicular distance to infinite line
8486
#' Applies only when xp, yp in the middle
8587
middle <- (xpr >= 0 & xpr <= leng)
86-
if(any(middle))
88+
if(any(middle)) {
89+
ypr <- - si * xpl + co * ypl
8790
dmin[middle] <- pmin.int(dmin[middle], abs(ypr[middle]))
88-
91+
}
8992
return(dmin)
9093
}
9194

@@ -173,19 +176,25 @@ distppll <- function(p, l, mintype=0,
173176
#' (distance to) nearest segment
174177

175178
distppllmin <- function(p, l, big=NULL) {
179+
## find distance from each point to nearest segment
180+
## and identifier of nearest segment
176181
if(is.null(big)) {
177182
xdif <- diff(range(c(p[,1],l[, c(1,3)])))
178183
ydif <- diff(range(c(p[,2],l[, c(2,4)])))
179184
big <- 2 * (xdif^2 + ydif^2)
180185
}
181186
z <- NNdist2segments(p[,1], p[,2],
182187
l[,1], l[,2], l[,3], l[,4],
183-
big)
188+
bigvalue=big,
189+
wantindex=TRUE, wantproj=FALSE)
184190
return(list(min.d=sqrt(z$dist2), min.which=z$index))
185191
}
186192

187193
NNdist2segments <- function(xp, yp, x0, y0, x1, y1, bigvalue,
188194
wantindex=TRUE, wantproj=FALSE) {
195+
## find distance from each point to nearest segment
196+
## If 'wantindex' then also return index of segment
197+
## If 'wantproj' then also return (x,y) and (tp) coordinates of projection
189198
np <- length(xp)
190199
ns <- length(x0)
191200
dist2 <- rep(bigvalue, np)

inst/doc/packagesizes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
3333
"2025-09-20" "3.2-0" 42 195 0 3716 2462
3434
"2026-01-08" "3.2-1" 43 196 0 3754 2535
3535
"2026-03-10" "3.2-2" 44 197 0 3778 2535
36-
"2026-05-07" "3.2-2.006" 44 197 0 3808 2683
36+
"2026-05-10" "3.2-3" 44 197 0 3817 2683

inst/info/packagesizes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ date version nhelpfiles nobjects ndatasets Rlines srclines
3333
"2025-09-20" "3.2-0" 42 195 0 3716 2462
3434
"2026-01-08" "3.2-1" 43 196 0 3754 2535
3535
"2026-03-10" "3.2-2" 44 197 0 3778 2535
36-
"2026-05-07" "3.2-2.006" 44 197 0 3808 2683
36+
"2026-05-10" "3.2-3" 44 197 0 3817 2683

0 commit comments

Comments
 (0)