NASbasic.tri {pcds} | R Documentation |
The vertices of the Arc Slice (AS) Proximity Region in the standard basic triangle
Description
Returns the end points of the line segments and arc-slices that constitute the boundary of
AS proximity region for a point in the standard basic triangle 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
.
Vertex regions are based on the center, M=(m_1,m_2)
in Cartesian coordinates
or M=(\alpha,\beta,\gamma)
in barycentric coordinates
in the interior of the standard basic triangle T_b
or based on circumcenter of T_b
;
default is M="CC"
, i.e., circumcenter of T_b
.
rv
is the index of the vertex region p
resides, with default=NULL
.
If p
is outside T_b
, it returns NULL
for the proximity region.
dec
is the number of decimals (default is 4) to round the barycentric coordinates when checking whether
the end points fall on the boundary of the triangle T_b
or not (so as not to miss the intersection points
due to precision in the decimals).
Any given triangle can be mapped to the standard basic triangle 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 is useful for simulation studies under the uniformity hypothesis.
See also (Ceyhan (2005, 2010)).
Usage
NASbasic.tri(p, c1, c2, M = "CC", rv = NULL, dec = 4)
Arguments
p |
A 2D point whose AS proximity region is to be computed. |
c1 , c2 |
Positive real numbers representing the top vertex in standard basic triangle |
M |
The center of the triangle. |
rv |
The index of the |
dec |
a positive integer the number of decimals (default is 4) to round the barycentric coordinates when checking whether
the end points fall on the boundary of the triangle |
Value
A list
with the elements
L , R |
The end points of the line segments on the boundary of the AS proximity region.
Each row in |
Arc.Slices |
The end points of the arc-slices on the circular parts of the AS proximity region. Here points in row 1 and row 2 constitute the end points of one arc-slice, points on row 3 and row 4 constitute the end points for the next arc-slice and so on. |
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
Examples
c1<-.4; c2<-.6 #try also c1<-.2; c2<-.2;
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);
Tb<-rbind(A,B,C)
set.seed(1)
M<-as.numeric(runif.basic.tri(1,c1,c2)$g) #try also M<-c(.6,.2)
P1<-as.numeric(runif.basic.tri(1,c1,c2)$g); #try also P1<-c(.3,.2)
NASbasic.tri(P1,c1,c2) #default with M="CC"
NASbasic.tri(P1,c1,c2,M)
#or try
Rv<-rel.vert.basic.triCC(P1,c1,c2)$rv
NASbasic.tri(P1,c1,c2,M,Rv)
NASbasic.tri(c(3,5),c1,c2,M)
P2<-c(.5,.4)
NASbasic.tri(P2,c1,c2,M)
P3<-c(1.5,.4)
NASbasic.tri(P3,c1,c2,M)
if (dimension(M)==3) {M<-bary2cart(M,Tr)}
#need to run this when M is given in barycentric coordinates
#plot of the NAS region
P1<-as.numeric(runif.basic.tri(1,c1,c2)$g);
CC<-circumcenter.basic.tri(c1,c2)
if (isTRUE(all.equal(M,CC)) || identical(M,"CC"))
{cent<-CC
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)
cent.name<-"CC"
rv<-rel.vert.basic.triCC(P1,c1,c2)$rv
} else
{cent<-M
cent.name<-"M"
Ds<-prj.cent2edges.basic.tri(c1,c2,M)
rv<-rel.vert.basic.tri(P1,c1,c2,M)$rv
}
RV<-Tb[rv,]
rad<-Dist(P1,RV)
Int.Pts<-NASbasic.tri(P1,c1,c2,M)
Xlim<-range(Tb[,1],P1[1]+rad,P1[1]-rad)
Ylim<-range(Tb[,2],P1[2]+rad,P1[2]-rad)
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(A,pch=".",asp=1,xlab="",ylab="",xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Tb)
points(rbind(Tb,P1,rbind(Int.Pts$L,Int.Pts$R)))
L<-rbind(cent,cent,cent); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
interp::circles(P1[1],P1[2],rad,lty=2)
L<-Int.Pts$L; R<-Int.Pts$R
segments(L[,1], L[,2], R[,1], R[,2], lty=1,col=2)
Arcs<-Int.Pts$a;
if (!is.null(Arcs))
{
K<-nrow(Arcs)/2
for (i in 1:K)
{A1<-Arcs[2*i-1,]; A2<-Arcs[2*i,];
angles<-angle.str2end(A1,P1,A2)$c
plotrix::draw.arc(P1[1],P1[2],rad,angle1=angles[1],angle2=angles[2],col=2)
}
}
#proximity region with the triangle (i.e., for labeling the vertices of the NAS)
IP.txt<-intpts<-c()
if (!is.null(Int.Pts$a))
{
intpts<-unique(round(Int.Pts$a,7))
#this part is for labeling the intersection points of the spherical
for (i in 1:(length(intpts)/2))
IP.txt<-c(IP.txt,paste("I",i+1, sep = ""))
}
txt<-rbind(Tb,P1,cent,intpts)
txt.str<-c("A","B","C","P1",cent.name,IP.txt)
text(txt+cbind(rep(xd*.02,nrow(txt)),rep(-xd*.03,nrow(txt))),txt.str)
c1<-.4; c2<-.6;
P1<-c(.3,.2)
NASbasic.tri(P1,c1,c2,M)