runif.multi.tri {pcds}R Documentation

Generation of Uniform Points in the Convex Hull of Points

Description

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 (Okabe et al. (2000); Ceyhan (2010); Sinclair (2016)) for more on Delaunay triangulation and the corresponding algorithm.

Usage

runif.multi.tri(n, Yp, DTmesh = NULL)

Arguments

n

A positive integer representing the number of uniform points to be generated in the convex hull of the point set Yp.

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 tri.mesh function from interp package).

Value

A list with the elements

type

The type of the pattern from which points are to be generated

mtitle

The "main" title for the plot of the point pattern

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 Yp

out.region

The outer region which contains the support region, NULL for this function.

desc.pat

Description of the point pattern from which points are to be generated

num.points

The vector of two numbers, which are the number of generated points and the number of vertices in the triangulation (i.e., size of Yp) points.

txt4pnts

Description of the two numbers in num.points

xlimit, ylimit

The ranges of the x- and y-coordinates of the points in Yp

Author(s)

Elvan Ceyhan

References

Ceyhan E (2010). “Extension of One-Dimensional Proximity Regions to Higher Dimensions.” Computational Geometry: Theory and Applications, 43(9), 721-748.

Okabe A, Boots B, Sugihara K, Chiu SN (2000). Spatial Tessellations: Concepts and Applications of Voronoi Diagrams. Wiley, New York.

Sinclair D (2016). “S-hull: a fast radial sweep-hull routine for Delaunay triangulation.” 1604.01428.

See Also

runif.tri, runif.std.tri, and runif.basic.tri,

Examples


#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)



[Package pcds version 0.1.8 Index]