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

pointsOnLines

Place Points Evenly Along Specified Lines


Description

Given a line segment pattern, place a series of points at equal distances along each line segment.

Usage

pointsOnLines(X, eps = NULL, np = 1000, shortok=TRUE)

Arguments

X

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

eps

Spacing between successive points.

np

Approximate total number of points (incompatible with eps).

shortok

Logical. If FALSE, very short segments (of length shorter than eps) will not generate any points. If TRUE, a very short segment will be represented by its midpoint.

Details

For each line segment in the pattern X, a succession of points is placed along the line segment. These points are equally spaced at a distance eps, except for the first and last points in the sequence.

The spacing eps is measured in coordinate units of X.

If eps is not given, then it is determined by eps = len/np where len is the total length of the segments in X. The actual number of points will then be slightly larger than np.

Value

A point pattern (object of class "ppp") in the same window as X. The result also has an attribute called "map" which maps the points to their parent line segments.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

X <- psp(runif(20), runif(20), runif(20), runif(20),  window=owin())
  Y <- pointsOnLines(X, eps=0.05)
  plot(X, main="")
  plot(Y, add=TRUE, pch="+")

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.