rel.edge.triCM {pcds} | R Documentation |
The index of the
-edge region in a triangle
that contains the point
Description
Returns the index of the edge
whose region contains point, p
, in
the triangle tri
with edge regions based on center of mass
.
Edges are labeled as 3 for edge ,
1 for edge
, and 2 for edge
.
If the point,
p
, is not inside tri
,
then the function yields NA
as output.
Edge region 1 is the triangle ,
edge region 2 is
, and
edge region 3 is
.
See also (Ceyhan (2005, 2010); Ceyhan et al. (2007)).
Usage
rel.edge.triCM(p, tri)
Arguments
p |
A 2D point for which |
tri |
A |
Value
A list
with three elements
re |
Index of the |
tri |
The vertices of the triangle,
where row labels are |
desc |
Description of the edge labels |
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.
Ceyhan E, Priebe CE, Marchette DJ (2007).
“A new family of random graphs for testing spatial segregation.”
Canadian Journal of Statistics, 35(1), 27-50.
See Also
rel.edge.tri
, rel.edge.basic.triCM
,
rel.edge.basic.tri
, rel.edge.std.triCM
,
and edge.reg.triCM
Examples
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);
P<-c(1.4,1.2)
rel.edge.triCM(P,Tr)
P<-c(1.5,1.61)
rel.edge.triCM(P,Tr)
CM<-(A+B+C)/3
n<-20 #try also n<-40
Xp<-runif.tri(n,Tr)$g
re<-vector()
for (i in 1:n)
re<-c(re,rel.edge.triCM(Xp[i,],Tr)$re)
re
Xlim<-range(Tr[,1],Xp[,1])
Ylim<-range(Tr[,2],Xp[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Tr,xlab="",ylab="",axes=TRUE,pch=".",xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
points(Xp,pch=".")
polygon(Tr)
L<-Tr; R<-matrix(rep(CM,3),ncol=2,byrow=TRUE)
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)
text(Xp,labels=factor(re))
txt<-rbind(Tr,CM)
xc<-txt[,1]
yc<-txt[,2]
txt.str<-c("A","B","C","CM")
text(xc,yc,txt.str)
p1<-(A+B+CM)/3
p2<-(B+C+CM)/3
p3<-(A+C+CM)/3
plot(Tr,xlab="",ylab="",axes=TRUE,pch=".",xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tr)
L<-Tr; R<-matrix(rep(CM,3),ncol=2,byrow=TRUE)
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)
txt<-rbind(Tr,CM,p1,p2,p3)
xc<-txt[,1]+c(-.02,.02,.02,.02,.02,.02,.02)
yc<-txt[,2]+c(.02,.02,.04,.05,.02,.02,.02)
txt.str<-c("A","B","C","CM","re=3","re=1","re=2")
text(xc,yc,txt.str)