mercredi 6 janvier 2021

R generate points with condition using runifpoint function

I am trying to generate randomly distributed points in a rectangle.

To create 50 random points in a rectangle, I used

i=50
  pp<-runifpoint(i, win=owin(c(0,19.5),c(0,3.12))

If I were to add conditions on the coordinates before randomly generating points,

e.g. 0.24 <x<19.26 ,0.24<y<2.64 , then generate random points, what code can I imply?

The ultimate goal is to generate points in the rectangle except for the grey shaded area, in the below image

enter image description here




Aucun commentaire:

Enregistrer un commentaire