Learn R Programming

spatstat.geom (version 3.6-0)

closepairs.pp3: Close Pairs of Points in 3 Dimensions

Description

Low-level functions to find all close pairs of points in three-dimensional point patterns.

Usage

# S3 method for pp3
closepairs(X, rmax, twice=TRUE,
                         what=c("all", "indices", "ijd"),
                         distinct=TRUE, neat=TRUE, ...)

# S3 method for pp3 crosspairs(X, Y, rmax, what=c("all", "indices", "ijd"), ...)

Arguments

Value

A list with components i and j, and possibly other components as described under Details.

Details

These are the efficient low-level functions used by spatstat to find all close pairs of points in a three-dimensional point pattern or all close pairs between two point patterns in three dimensions.

closepairs(X,rmax) identifies all pairs of neighbours in the pattern X and returns them. The result is a list with the following components:

i

Integer vector of indices of the first point in each pair.

j

Integer vector of indices of the second point in each pair.

xi,yi,zi

Coordinates of the first point in each pair.

xj,yj,zj

Coordinates of the second point in each pair.

dx

Equal to xj-xi

dy

Equal to yj-yi

dz

Equal to zj-zi

d

Euclidean distance between each pair of points.

If what="indices" then only the components i and j are returned. This is slightly faster.

crosspairs(X,rmax) identifies all pairs of neighbours (X[i], Y[j]) between the patterns X and Y, and returns them. The result is a list with the same format as for closepairs.

See Also

closepairs

Examples

Run this code
   X <- pp3(runif(10), runif(10), runif(10), box3(c(0,1)))
   Y <- pp3(runif(10), runif(10), runif(10), box3(c(0,1)))
   a <- closepairs(X, 0.1)
   b <- crosspairs(X, Y, 0.1)

Run the code above in your browser using DataLab