rel.vert.std.triCM {pcds} | R Documentation |
The index of the CM
-vertex region
in the standard equilateral triangle that contains a given point
Description
Returns the index of the vertex
whose region contains point p
in standard equilateral triangle
T_e=T((0,0),(1,0),(1/2,\sqrt{3}/2))
with vertex regions are constructed with center of mass CM
(see the plots in the example for illustrations).
The vertices of triangle, T_e
, are labeled as 1,2,3
according to the row number the vertex is recorded in T_e
.
If the point, p
, is not inside T_e
, 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.
See also (Ceyhan (2005, 2010)).
Usage
rel.vert.std.triCM(p)
Arguments
p |
A 2D point for which |
Value
A list
with two elements
rv |
Index of the vertex whose region contains point, |
tri |
The vertices of the triangle, |
Author(s)
Elvan Ceyhan
References
Ceyhan E (2005).
An Investigation of Proximity Catch Digraphs in Delaunay Tessellations, also available as technical monograph titled Proximity Catch Digraphs: Auxiliary Tools, Properties, and Applications.
Ph.D. thesis, The Johns Hopkins University, Baltimore, MD, 21218.
Ceyhan E (2010).
“Extension of One-Dimensional Proximity Regions to Higher Dimensions.”
Computational Geometry: Theory and Applications, 43(9), 721-748.
Ceyhan E (2012).
“An investigation of new graph invariants related to the domination number of random proximity catch digraphs.”
Methodology and Computing in Applied Probability, 14(2), 299-334.
See Also
rel.vert.basic.triCM
, rel.vert.tri
,
rel.vert.triCC
, rel.vert.basic.triCC
,
rel.vert.triCM
, and rel.vert.basic.tri
Examples
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C)
n<-20 #try also n<-40
set.seed(1)
Xp<-runif.std.tri(n)$gen.points
rel.vert.std.triCM(Xp[1,])
Rv<-vector()
for (i in 1:n)
Rv<-c(Rv,rel.vert.std.triCM(Xp[i,])$rv)
Rv
CM<-(A+B+C)/3
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)
Xlim<-range(Te[,1],Xp[,1])
Ylim<-range(Te[,2],Xp[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Te,asp=1,pch=".",xlab="",ylab="",axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Te)
points(Xp,pch=".",col=1)
L<-matrix(rep(CM,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)
txt<-rbind(Te,CM)
xc<-txt[,1]+c(-.02,.03,.02,0)
yc<-txt[,2]+c(.02,.02,.03,.05)
txt.str<-c("A","B","C","CM")
text(xc,yc,txt.str)
text(Xp,labels=factor(Rv))