runif.tri: Generation of Uniform Points in a Triangle

View source: R/PatternGen.R

runif.triR Documentation

Generation of Uniform Points in a Triangle

Description

An object of class "Uniform". Generates n points uniformly in a given triangle, tri

Usage

runif.tri(n, tri)

Arguments

n

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

tri

A 3 \times 2 matrix with each row representing a vertex of the triangle.

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 triangle tri for this function

gen.points

The output set of generated points uniformly in the triangle, tri.

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, tri

Author(s)

Elvan Ceyhan

See Also

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

Examples

## Not run: 
n<-100
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C)

Xdt<-runif.tri(n,Tr)
Xdt
summary(Xdt)
plot(Xdt)

Xp<-Xdt$g
Xlim<-range(Tr[,1])
Ylim<-range(Tr[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Tr,pch=".",xlab="",ylab="",main="Uniform Points in One Triangle",
     xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tr)
points(Xp)
xc<-Tr[,1]+c(-.02,.02,.02)
yc<-Tr[,2]+c(.02,.02,.04)
txt.str<-c("A","B","C")
text(xc,yc,txt.str)

## End(Not run)


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