Last chance! 50% off unlimited learning
Sale ends in
## S3 method for class 'psp':
crossdist(X, Y, \dots, method="Fortran", type="Hausdorff")
"psp"
)."Fortran"
, "C"
and "interpreted"
.
Usually not specified."Hausdorff"
and "separation"
. Partial matching is used.[i,j]
entry is the distance
from the i
-th line segment in X
to the j
-th line segment in Y
.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.
The distances between line segments are measured in one of two ways:
type="Hausdorff"
, distances are computed
in the Hausdorff metric. The Hausdorff
distance between two line segments is themaximumdistance
from any point on one of the segments to the nearest point on
the other segment.type="separation"
, distances are computed
as theminimumdistance from a point on one line segment to
a point on the other line segment. For example, line segments which
cross over each other have separation zero.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.pairdist
,
nndist
,
Gest
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
S <- crossdist(L1, L2, type="sep")
Run the code above in your browser using DataLab