edge.reg.triCM | R Documentation |
CM
-edge region in a triangle
that contains the pointReturns the edge whose region contains point, p
, in
the triangle tri
=T(A,B,C)
with edge regions based on center of mass CM=(A+B+C)/3
.
This function is related to rel.edge.triCM
,
but unlike rel.edge.triCM
the related edges are given as vertices ABC
for re=3
, as BCA
for re=1
and as CAB
for re=2
where edges are labeled as 3 for edge AB
,
1 for edge BC
,
and 2 for edge AC
.
The vertices are given one vertex in each row in the output,
e.g., ABC
is printed as rbind(A,B,C)
,
where row 1 has the entries of vertex A,
row 2 has the entries of vertex B,
and row 3 has the entries of vertex C.
If the point, p
, is not inside tri
,
then the function yields NA
as output.
Edge region for BCA is the triangle T(B,C,CM)
,
edge region CAB is T(A,C,CM)
, and edge region ABC is T(A,B,CM)
.
See also (\insertCiteceyhan:Phd-thesis,ceyhan:comp-geo-2010,ceyhan:mcap2012;textualpcds).
edge.reg.triCM(p, tri)
p |
A 2D point for which |
tri |
A |
The CM
-edge region that contains point,
p
in the triangle tri
.
The related edges are given as
vertices ABC
for re=3
,
as BCA
for re=1
and as CAB
for re=2
where edges are labeled as 3
for edge AB
, 1 for edge BC
, and 2 for edge AC
.
Elvan Ceyhan
rel.edge.tri
, rel.edge.triCM
,
rel.edge.basic.triCM
, rel.edge.basic.tri
,
rel.edge.std.triCM
, and edge.reg.triCM
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);
P<-c(.4,.2) #try also P<-as.numeric(runif.tri(1,Tr)$g)
edge.reg.triCM(P,Tr)
P<-c(1.8,.5)
edge.reg.triCM(P,Tr)
CM<-(A+B+C)/3
p1<-(A+B+CM)/3
p2<-(B+C+CM)/3
p3<-(A+C+CM)/3
Xlim<-range(Tr[,1])
Ylim<-range(Tr[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Tr,pch=".",xlab="",ylab="",axes=TRUE,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,-.05,0,0,0)
yc<-txt[,2]+c(.02,.02,.02,.02,0,0,0)
txt.str<-c("A","B","C","CM","re=T(A,B,CM)","re=T(B,C,CM)","re=T(A,C,CM)")
text(xc,yc,txt.str)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.