runif.multi.tri: Generation of Uniform Points in the Convex Hull of Points

View source: R/PatternGen.R

runif.multi.triR 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 (\insertCiteokabe:2000,ceyhan:comp-geo-2010,sinclair:2016;textualpcds) 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

\insertAllCited

See Also

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

Examples

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


elvanceyhan/pcds documentation built on June 29, 2023, 8:12 a.m.