rel.vert.end.int: The index of the vertex region in an end-interval that...

View source: R/AuxDelaunay.R

rel.vert.end.intR Documentation

The index of the vertex region in an end-interval that contains a given point

Description

Returns the index of the vertex in the interval, int, whose end interval contains the 1D point p, that is, it finds the index of the vertex for the point, p, outside the interval int=(a,b)=(vertex 1,vertex 2); vertices of interval are labeled as 1 and 2 according to their order in the interval.

If the point, p, is inside int, then the function yields NA as output. The corresponding vertex region is an interval as (-\infty,a) or (b,\infty) for the interval (a,b). Then if p<a, then rv=1 and if p>b, then rv=2. Unlike rel.vert.mid.int, centrality parameter (i.e., center of the interval is not relevant for rel.vert.end.int.)

See also (\insertCiteceyhan:metrika-2012,ceyhan:revstat-2016;textualpcds).

Usage

rel.vert.end.int(p, int)

Arguments

p

A 1D point whose end interval region is provided by the function.

int

A vector of two real numbers representing an interval.

Value

A list with two elements

rv

Index of the end vertex whose region contains point, p.

int

The vertices of the interval as a vector where position of the vertex corresponds to the vertex index as int=(rv=1,rv=2).

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

rel.vert.mid.int

Examples

## Not run: 
a<-0; b<-10; int<-c(a,b)

rel.vert.end.int(-6,int)
rel.vert.end.int(16,int)

n<-10
xf<-(int[2]-int[1])*.5
XpL<-runif(n,a-xf,a)
XpR<-runif(n,b,b+xf)
Xp<-c(XpL,XpR)
rel.vert.end.int(Xp[1],int)

Rv<-vector()
for (i in 1:length(Xp))
  Rv<-c(Rv,rel.vert.end.int(Xp[i],int)$rv)
Rv

Xlim<-range(a,b,Xp)
xd<-Xlim[2]-Xlim[1]

plot(cbind(a,0),xlab="",pch=".",xlim=Xlim+xd*c(-.05,.05))
abline(h=0)
abline(v=c(a,b),col=1,lty = 2)
points(cbind(Xp,0))
text(cbind(Xp,0.1),labels=factor(Rv))
text(cbind(c(a,b),-0.1),c("rv=1","rv=2"))

jit<-.1
yjit<-runif(length(Xp),-jit,jit)

Xlim<-range(a,b,Xp)
xd<-Xlim[2]-Xlim[1]

plot(cbind(a,0),
main="vertex region indices for the points\n in the end intervals",
     xlab=" ", ylab=" ",pch=".",xlim=Xlim+xd*c(-.05,.05),ylim=3*range(yjit))
points(Xp, yjit,xlim=Xlim+xd*c(-.05,.05),pch=".",cex=3)
abline(h=0)
abline(v=c(a,b),lty = 2)
text(Xp,yjit,labels=factor(Rv))
text(cbind(c(a,b),-.01),c("rv=1","rv=2"))

## End(Not run)


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