| runif.multi.tri | R Documentation | 
An object of class "Uniform".
Generates n points uniformly
in the Convex Hull of set of points, Yp.
That is, generates uniformly in each of the triangles
in the Delaunay triangulation of Yp, i.e.,
in the multiple triangles partitioning the convex hull of Yp.
If Yp consists only of 3 points,
then the function behaves like the
function runif.tri.
DTmesh is the Delaunay triangulation of Yp,
default is DTmesh=NULL.
DTmesh yields triangulation nodes with neighbours
(result of tri.mesh function
from interp package).
See (\insertCiteokabe:2000,ceyhan:comp-geo-2010,sinclair:2016;textualpcds) for more on Delaunay triangulation and the corresponding algorithm.
runif.multi.tri(n, Yp, DTmesh = NULL)
| n | A positive integer
representing the number of uniform points to be generated
in the convex hull of the point set  | 
| Yp | A set of 2D points whose convex hull is the support of the uniform points to be generated. | 
| DTmesh | Triangulation nodes with neighbours
(result of  | 
A list with the elements
| type | The type of the pattern from which points are to be generated | 
| mtitle | The  | 
| tess.points | The points which constitute the vertices of the triangulation and whose convex hull determines the support of the generated points. | 
| gen.points | The output set of generated points uniformly
in the convex hull of  | 
| out.region | The outer region which contains the support region,
 | 
| desc.pat | Description of the point pattern from which points are to be generated | 
| num.points | The  | 
| txt4pnts | Description of the two numbers in  | 
| xlimit,ylimit | The ranges of the  | 
Elvan Ceyhan
runif.tri, runif.std.tri,
and runif.basic.tri,
## Not run: 
#nx is number of X points (target) and ny is number of Y points (nontarget)
nx<-100; ny<-4;  #try also nx<-1000; ny<-10;
set.seed(1)
Yp<-cbind(runif(ny,0,10),runif(ny,0,10))
Xdt<-runif.multi.tri(nx,Yp)
#data under CSR in the convex hull of Ypoints
Xdt
summary(Xdt)
plot(Xdt)
Xp<-Xdt$g
#or use
DTY<-interp::tri.mesh(Yp[,1],Yp[,2],duplicate="remove")
#Delaunay triangulation based on Y points
Xp<-runif.multi.tri(nx,Yp,DTY)$g
#data under CSR in the convex hull of Ypoints
Xlim<-range(Yp[,1])
Ylim<-range(Yp[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
#plot of the data in the convex hull of Y points together with the Delaunay triangulation
plot(Xp, xlab=" ", ylab=" ",
main="Uniform Points in Convex Hull of Y Points",
xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05),type="n")
interp::plot.triSht(DTY, add=TRUE,
do.points = TRUE,pch=16,col="blue")
points(Xp,pch=".",cex=3)
Yp<-rbind(c(.3,.2),c(.4,.5),c(.14,.15))
runif.multi.tri(nx,Yp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.