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

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, nsim=1, drop=TRUE)

Arguments

n

Number of points to generate.

L

Line segment pattern (object of class "psp") on which the points should lie.

nsim

Number of simulated realisations to be generated.

drop

Logical. If nsim=1 and drop=TRUE (the default), the result will be a point pattern, rather than a list containing a point pattern.

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.

If n is a single integer, the result is an unmarked point pattern containing n points. If n is a vector of integers, the result is a marked point pattern, with m different types of points, where m = length(n), in which there are n[j] points of type j.

Value

If nsim = 1, a point pattern (object of class "ppp") with the same window as L. If nsim > 1, a list of point patterns.

Author(s)

See Also

Examples

X <- psp(runif(10), runif(10), runif(10), runif(10),  window=owin())
  Y <- runifpointOnLines(20, X)
  plot(X, main="")
  plot(Y, add=TRUE)
  Z <- runifpointOnLines(c(5,5), X)

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

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