NAStri {pcds} | R Documentation |
The vertices of the Arc Slice (AS) Proximity Region in a general 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 triangle tri
=T(A,B,C)=
(rv=1,rv=2,rv=3)
.
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 triangle tri
or based on circumcenter of tri
;
default is M="CC"
, i.e., circumcenter of tri
.
rv
is the index of the vertex region p1
resides,
with default=NULL
.
If p
is outside of tri
, it returns NULL
for the proximity region.
dec
is the number of decimals (default is 4) to round the barycentric coordinates when checking the points
fall on the boundary of the triangle tri
or not (so as not to miss the intersection points due to precision
in the decimals).
See also (Ceyhan (2005, 2010)).
Usage
NAStri(p, tri, M = "CC", rv = NULL, dec = 4)
Arguments
p |
A 2D point whose AS proximity region is to be computed. |
tri |
Three 2D points, stacked row-wise, each row representing a vertex of the triangle. |
M |
The center of the triangle. |
rv |
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 |
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 rows 1 and 2 constitute the end points of the first arc-slice, points on rows 3 and 4 constitute the end points for the next arc-slice and so on. |
Angles |
The angles (in radians) between the vectors joining arc slice end points to the point |
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
NASbasic.tri
, NPEtri
, NCStri
and IarcAStri
Examples
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);
M<-as.numeric(runif.tri(1,Tr)$g) #try also M<-c(.6,.2)
P1<-as.numeric(runif.tri(1,Tr)$g) #try also P1<-c(1.3,1.2)
NAStri(P1,Tr,M)
#or try
Rv<-rel.vert.triCC(P1,Tr)$rv
NAStri(P1,Tr,M,Rv)
NAStri(c(3,5),Tr,M)
P2<-c(1.5,1.4)
NAStri(P2,Tr,M)
P3<-c(1.5,.4)
NAStri(P3,Tr,M)
if (dimension(M)==3) {M<-bary2cart(M,Tr)}
#need to run this when M is given in barycentric coordinates
CC<-circumcenter.tri(Tr) #the circumcenter
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.triCC(P1,Tr)$rv
} else
{cent<-M
cent.name<-"M"
Ds<-prj.cent2edges(Tr,M)
rv<-rel.vert.tri(P1,Tr,M)$rv
}
RV<-Tr[rv,]
rad<-Dist(P1,RV)
Int.Pts<-NAStri(P1,Tr,M)
#plot of the NAS region
Xlim<-range(Tr[,1],P1[1]+rad,P1[1]-rad)
Ylim<-range(Tr[,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))
#asp=1 must be the case to have the arc properly placed in the figure
polygon(Tr)
points(rbind(Tr,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<-Int.Pts$arc[2*i-1,]; A2<-Int.Pts$arc[2*i,];
angles<-angle.str2end(A1,P1,A2)$c
test.ang1<-angles[1]+(.01)*(angles[2]-angles[1])
test.Pnt<-P1+rad*c(cos(test.ang1),sin(test.ang1))
if (!in.triangle(test.Pnt,Tr,boundary = TRUE)$i) {angles<-c(min(angles),max(angles)-2*pi)}
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(Tr,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)
P1<-c(.3,.2)
NAStri(P1,Tr,M)