crossdist.psp {spatstat} | R Documentation |
Computes the distances between all pairs of line segments taken from two different line segment patterns.
## S3 method for class 'psp': crossdist(X, Y, ..., method="Fortran")
X,Y |
Line segment patterns (objects of class "psp" ).
|
... |
Ignored. |
method |
String specifying which method of calculation to use.
Values are "Fortran" and "interpreted" .
|
This is a method for the generic function crossdist
.
Given two line segment patterns, this function computes the distance from each line segment in the first pattern to each line segment in the second pattern, and returns a matrix containing these distances.
Distances are calculated using the Hausdorff metric. The Hausdorff distance between two line segments is the maximum distance from any point on one of the segments to the nearest point on the other segment.
The argument method
is not normally used. It is
retained only for checking the validity of the software.
If method = "interpreted"
then the distances are
computed using interpreted R code only. If method="Fortran"
(the default) then Fortran code is used.
The Fortran code is several times faster.
A matrix whose [i,j]
entry is the distance
from the i
-th line segment in X
to the j
-th line segment in Y
.
Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner rolf@math.unb.ca http://www.math.unb.ca/~rolf
L1 <- psp(runif(5), runif(5), runif(5), runif(5), owin()) L2 <- psp(runif(10), runif(10), runif(10), runif(10), owin()) D <- crossdist(L1, L2) #result is a 5 x 10 matrix