rel.vert.basic.triCM: The index of the CM-vertex region in a standard basic...

View source: R/AuxDelaunay.R

rel.vert.basic.triCMR Documentation

The index of the CM-vertex region in a standard basic triangle form that contains a point

Description

Returns the index of the vertex whose region contains point p in the standard basic triangle form 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 and vertex regions are based on the center of mass CM=((1+c1)/3,c2/3) of T_b. (see the plots in the example for illustrations).

The vertices of the standard basic triangle form T_b are labeled as 1=(0,0), 2=(1,0),and 3=(c_1,c_2) also according to the row number the vertex is recorded in T_b. If the point, p, is not inside T_b, then the function yields NA as output. The corresponding vertex region is the polygon with the vertex, CM, and midpoints of the edges adjacent to the vertex.

Any given triangle can be mapped to the standard basic triangle form by a combination of rigid body motions (i.e., translation, rotation and reflection) and scaling, preserving uniformity of the points in the original triangle. Hence, standard basic triangle form is useful for simulation studies under the uniformity hypothesis.

See also (\insertCiteceyhan:Phd-thesis,ceyhan:comp-geo-2010,ceyhan:mcap2012,ceyhan:arc-density-PE;textualpcds)

Usage

rel.vert.basic.triCM(p, c1, c2)

Arguments

p

A 2D point for which CM-vertex region it resides in is to be determined in the standard basic triangle form T_b.

c1, c2

Positive real numbers which constitute the upper vertex of the standard basic triangle form (i.e., the vertex adjacent to the shorter edges of T_b); c_1 must be in [0,1/2], c_2>0 and (1-c_1)^2+c_2^2 \le 1.

Value

A list with two elements

rv

Index of the CM-vertex region that contains point, p in the standard basic triangle form T_b

tri

The vertices of the triangle, where row number corresponds to the vertex index in rv with row 1=(0,0), row 2=(1,0), and row 3=(c_1,c_2).

References

\insertAllCited

#' @author Elvan Ceyhan

See Also

rel.vert.triCM, rel.vert.tri, rel.vert.triCC, rel.vert.basic.triCC, rel.vert.basic.tri, and rel.vert.std.triCM

Examples

## Not run: 
c1<-.4; c2<-.6
P<-c(.4,.2)
rel.vert.basic.triCM(P,c1,c2)

A<-c(0,0);B<-c(1,0);C<-c(c1,c2);
Tb<-rbind(A,B,C)
CM<-(A+B+C)/3
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)

n<-20  #try also n<-40
Xp<-runif.basic.tri(n,c1,c2)$g

Rv<-vector()
for (i in 1:n)
  Rv<-c(Rv,rel.vert.basic.triCM(Xp[i,],c1,c2)$rv)
Rv

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

plot(Tb,xlab="",ylab="",axes="T",pch=".",xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
points(Xp,pch=".")
polygon(Tb)
L<-Ds; R<-matrix(rep(CM,3),ncol=2,byrow=TRUE)
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)
text(Xp,labels=factor(Rv))

txt<-rbind(Tb,CM,Ds)
xc<-txt[,1]+c(-.03,.03,.02,-.01,.06,-.05,.0)
yc<-txt[,2]+c(.02,.02,.02,.04,.02,.02,-.03)
txt.str<-c("A","B","C","CM","D1","D2","D3")
text(xc,yc,txt.str)

plot(Tb,xlab="",ylab="",axes="T",pch=".",xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tb)
L<-Ds; R<-matrix(rep(CM,3),ncol=2,byrow=TRUE)
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)

RV1<-(A+D3+CM+D2)/4
RV2<-(B+D3+CM+D1)/4
RV3<-(C+D2+CM+D1)/4

txt<-rbind(RV1,RV2,RV3)
xc<-txt[,1]
yc<-txt[,2]
txt.str<-c("rv=1","rv=2","rv=3")
text(xc,yc,txt.str)

txt<-rbind(Tb,CM,Ds)
xc<-txt[,1]+c(-.03,.03,.02,-.01,.04,-.03,.0)
yc<-txt[,2]+c(.02,.02,.02,.04,.02,.02,-.03)
txt.str<-c("A","B","C","CM","D1","D2","D3")
text(xc,yc,txt.str)

## End(Not run)


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