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