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

distmap.psp

Distance Map of Line Segment Pattern


Description

Computes the distance from each pixel to the nearest line segment in the given line segment pattern.

Usage

## S3 method for class 'psp'
distmap(X, ...)

Arguments

X

A line segment pattern (object of class "psp").

...

Arguments passed to as.mask to control pixel resolution.

Details

The “distance map” of a line segment pattern X is the function f whose value f(u) is defined for any two-dimensional location u as the shortest distance from u to X.

This function computes the distance map of the line segment pattern X and returns the distance map as a pixel image. The greyscale value at a pixel u equals the distance from u to the nearest line segment of the pattern X. Distances are computed using analytic geometry.

Additionally, the return value has two attributes, "index" and "bdry", which are also pixel images. The grey values in "bdry" give the distance from each pixel to the bounding rectangle of the image. The grey values in "index" are integers identifying which line segment of X is closest.

This is a method for the generic function distmap.

Note that this function gives the exact distance from the centre of each pixel to the nearest line segment. To compute the exact distance from the points in a point pattern to the nearest line segment, use distfun or one of the low-level functions nncross or project2segment.

Value

A pixel image (object of class "im") whose greyscale values are the values of the distance map. The return value has attributes "index" and "bdry" which are also pixel images.

Author(s)

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

See Also

Examples

a <- psp(runif(20),runif(20),runif(20),runif(20), window=owin())
    Z <- distmap(a)
    plot(Z)
    plot(a, add=TRUE)

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.