Pairwise distances in Three Dimensions
Computes the matrix of distances between all pairs of points in a three-dimensional point pattern.
## S3 method for class 'pp3': pairdist(X, \dots, periodic=FALSE, squared=FALSE)
- A point pattern (object of class
- Logical. Specifies whether to apply a periodic edge correction.
- Logical. If
squared=TRUE, the squared distances are returned instead (this computation is faster).
This is a method for the generic function
Given a three-dimensional point pattern
(an object of class
this function computes the Euclidean distances between all pairs of
X, and returns the matrix of distances.
periodic=TRUE and the window containing
X is a
box, then the distances will be computed in the `periodic'
sense (also known as `torus' distance): opposite faces of the
box are regarded as equivalent.
This is meaningless if the window is not a box.
squared=TRUE then the squared Euclidean distances
$d^2$ are returned, instead of the Euclidean distances $d$.
The squared distances are faster to calculate, and are sufficient for
many purposes (such as finding the nearest neighbour of a point).
- A square matrix whose
[i,j]entry is the distance between the points numbered
X <- runifpoint3(20) d <- pairdist(X) d <- pairdist(X, periodic=TRUE) d <- pairdist(X, squared=TRUE)