
rpoisppOnLines(lambda, L, lmax = NULL, ...)
function(x,y)
, or a pixel image
(object of class "im"
)."psp"
)
on which the points should be generated.lambda
if it is a function or a pixel image.lambda
if it is a
function."ppp"
) in the same window
as L
.L
. The result is a point pattern
consisting of points lying on the line segments in L
.
The number of random points falling on any given line segment follows
a Poisson distribution. The patterns of points on different segments
are independent. The intensity lambda
is the expected number of points
per unit length of line segment.
It may be constant, or it may depend on spatial location.
The argument lambda
may be a single number,
or a function(x,y)
, or a pixel image (object of class
"im"
). In the two latter cases, the rejection method is used.
The rejection method requires knowledge of lmax
,
the maximum possible value of lambda
. If lmax
is not
given, it will be computed approximately, by sampling many values of
lambda
.
psp
,
ppp
,
runifpointOnLines
,
rpoispp
L <- psp(runif(10), runif(10), runif(10), runif(10), window=owin())
plot(L, main="")
# uniform intensity
Y <- rpoisppOnLines(4, L)
plot(Y, add=TRUE, pch="+")
# intensity is a function
Y <- rpoisppOnLines(function(x,y){ 10 * x^2}, L, 10)
plot(L, main="")
plot(Y, add=TRUE, pch="+")
# intensity is an image
Z <- as.im(function(x,y){10 * sqrt(x+y)}, unit.square())
Y <- rpoisppOnLines(Z, L, 10)
plot(L, main="")
plot(Y, add=TRUE, pch="+")
Run the code above in your browser using DataLab