Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

crossdist.psp

Pairwise distances between two different line segment patterns


Description

Computes the distances between all pairs of line segments taken from two different line segment patterns.

Usage

## S3 method for class 'psp'
crossdist(X, Y, ..., method="C", type="Hausdorff")

Arguments

X,Y

Line segment patterns (objects of class "psp").

...

Ignored.

method

String specifying which method of calculation to use. Values are "C" and "interpreted". Usually not specified.

type

Type of distance to be computed. Options are "Hausdorff" and "separation". Partial matching is used.

Details

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.

The distances between line segments are measured in one of two ways:

  • if type="Hausdorff", distances are computed in 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.

  • if type="separation", distances are computed as the minimum distance 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.

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="C" (the default) then compiled C code is used. The C code is several times faster.

Value

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.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

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")

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.