Learn R Programming

spatstat (version 1.23-1)

runifpointOnLines: Generate N Uniform Random Points On Line Segments

Description

Given a line segment pattern, generate a random point pattern consisting of n points uniformly distributed on the line segments.

Usage

runifpointOnLines(n, L)

Arguments

n
Number of points to generate.
L
Line segment pattern (object of class "psp") on which the points should lie.

Value

  • A point pattern (object of class "ppp") with the same window as L.

Details

This command generates a point pattern consisting of n independent random points, each point uniformly distributed on the line segment pattern. This means that, for each random point,
  • the probability of falling on a particular segment is proportional to the length of the segment; and
  • given that the point falls on a particular segment, it has uniform probability density along that segment.

See Also

psp, ppp, pointsOnLines, runifpoint

Examples

Run this code
X <- psp(runif(10), runif(10), runif(10), runif(10),  window=owin())
  Y <- runifpointOnLines(20, X)
  plot(X, main="")
  plot(Y, add=TRUE)

Run the code above in your browser using DataLab