Learn R Programming

pcds (version 0.1.8)

runif.basic.tri: Generation of Uniform Points in the standard basic triangle

Description

An object of class "Uniform". Generates n points uniformly in the standard basic triangle \(T_b=T((0,0),(1,0),(c_1,c_2))\) where \(c_1\) is in \([0,1/2]\), \(c_2>0\) and \((1-c_1)^2+c_2^2 \le 1\).

Any given triangle can be mapped to the basic triangle by a combination of rigid body motions (i.e., translation, rotation and reflection) and scaling, preserving uniformity of the points in the original triangle (ceyhan:Phd-thesis,ceyhan:arc-density-CS,ceyhan:arc-density-PE;textualpcds). Hence, standard basic triangle is useful for simulation studies under the uniformity hypothesis.

Usage

runif.basic.tri(n, c1, c2)

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 vertices of the support of the uniformly generated points, it is the standard basic triangle \(T_b\) for this function

gen.points

The output set of generated points uniformly in the standard basic triangle

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 of the support points (here it is 3).

txt4pnts

Description of the two numbers in num.points.

xlimit,ylimit

The ranges of the \(x\)- and \(y\)-coordinates of the support, Tb

Arguments

n

A positive integer representing the number of uniform points to be generated in the standard basic triangle.

c1, c2

Positive real numbers representing the top vertex in standard basic triangle \(T_b=T((0,0),(1,0),(c_1,c_2))\), \(c_1\) must be in \([0,1/2]\), \(c_2>0\) and \((1-c_1)^2+c_2^2 \le 1\).

Author

Elvan Ceyhan

References

See Also

runif.std.tri, runif.tri, and runif.multi.tri

Examples

Run this code
# \donttest{
c1<-.4; c2<-.6
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);
Tb<-rbind(A,B,C);
n<-100

set.seed(1)
runif.basic.tri(1,c1,c2)
Xdt<-runif.basic.tri(n,c1,c2)
Xdt
summary(Xdt)
plot(Xdt)

Xp<-runif.basic.tri(n,c1,c2)$g

Xlim<-range(Tb[,1])
Ylim<-range(Tb[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]

plot(Tb,xlab="",ylab="",xlim=Xlim+xd*c(-.01,.01),
ylim=Ylim+yd*c(-.01,.01),type="n")
polygon(Tb)
points(Xp)
# }

Run the code above in your browser using DataLab