rel.vert.triCC {pcds} | R Documentation |
The index of the CC
-vertex region in a triangle
that contains a point
Description
Returns the index of the vertex
whose region contains point p
in
a triangle tri
=(A,B,C)
and vertex regions are based on the circumcenter CC
of tri
.
(see the plots in the example for illustrations).
The vertices of the triangle tri
are labeled as
1=A
, 2=B
, and 3=C
also
according to the row number the vertex is recorded in tri
.
If the point, p
, is not inside tri
,
then the function yields NA
as output.
The corresponding vertex region is the polygon
whose interior points are closest to that vertex.
If tri
is equilateral triangle,
then CC
and CM
(center of mass) coincide.
See also (Ceyhan (2005, 2010)).
Usage
rel.vert.triCC(p, tri)
Arguments
p |
A 2D point for which |
tri |
A |
Value
A list
with two elements
rv |
Index of the |
tri |
The vertices of the triangle,
where row number corresponds to the vertex index in |
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.tri
, rel.vert.triCM
,
rel.vert.basic.triCM
, rel.vert.basic.triCC
,
rel.vert.basic.tri
, and rel.vert.std.triCM
Examples
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);
P<-c(1.3,1.2)
rel.vert.triCC(P,Tr)
CC<-circumcenter.tri(Tr) #the circumcenter
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)
Xlim<-range(Tr[,1],CC[1])
Ylim<-range(Tr[,2],CC[2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Tr,asp=1,xlab="",ylab="",pch=".",axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tr)
L<-matrix(rep(CC,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)
txt<-rbind(Tr,CC,Ds)
xc<-txt[,1]+c(-.07,.08,.06,.12,-.1,-.1,-.09)
yc<-txt[,2]+c(.02,-.02,.03,.0,.02,.06,-.04)
txt.str<-c("A","B","C","CC","D1","D2","D3")
text(xc,yc,txt.str)
RV1<-(A+.5*(D3-A)+A+.5*(D2-A))/2
RV2<-(B+.5*(D3-B)+B+.5*(D1-B))/2
RV3<-(C+.5*(D2-C)+C+.5*(D1-C))/2
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)
n<-20 #try also n<-40
Xp<-runif.tri(n,Tr)$g
Rv<-vector()
for (i in 1:n)
Rv<-c(Rv,rel.vert.triCC(Xp[i,],Tr)$rv)
Rv
Xlim<-range(Tr[,1],Xp[,1])
Ylim<-range(Tr[,2],Xp[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Tr,asp=1,xlab="",ylab="",
main="Illustration of CC-Vertex Regions\n in a Triangle",
pch=".",axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tr)
points(Xp,pch=".")
L<-matrix(rep(CC,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty = 2)
text(Xp,labels=factor(Rv))
txt<-rbind(Tr,CC,Ds)
xc<-txt[,1]+c(-.07,.08,.06,.12,-.1,-.1,-.09)
yc<-txt[,2]+c(.02,-.02,.03,.0,.02,.06,-.04)
txt.str<-c("A","B","C","CC","D1","D2","D3")
text(xc,yc,txt.str)