Last chance! 50% off unlimited learning
Sale ends in
Returns the projections from a general center M
to the vertices (see the examples for an illustration).
In the basic triangle
Any given triangle can be mapped to the 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 basic triangle is useful for simulation studies under the uniformity hypothesis.
See also (ceyhan:Phd-thesis,ceyhan:comp-geo-2010;textualpcds).
cp2e.bastri(c1, c2, M)
Three projection points (stacked row-wise) from a general center M
to the vertices;
row
Positive real numbers which constitute the vertex of the basic triangle
adjacent to the shorter edges;
A 2D point in Cartesian coordinates or a 3D point in barycentric coordinates which serves as a center in the interior of the basic triangle.
Elvan Ceyhan
cp2e.tri
and cp2edges.nd
c1<-.4; c2<-.6
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);
Tb<-rbind(A,B,C);
M<-as.numeric(runif.bastri(1,c1,c2)$g) #try also M<-c(.6,.2)
cp2e.bastri(c1,c2,M)
Ds<-cp2e.bastri(c1,c2,M)
Xlim<-range(Tb[,1])
Ylim<-range(Tb[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
if (dimension(M)==3) {M<-bary2cart(M,Tb)}
#need to run this when M is given in barycentric coordinates
plot(Tb,pch=".",xlab="",ylab="",axes=TRUE,
xlim=Xlim+xd*c(-.1,.1),ylim=Ylim+yd*c(-.05,.05))
polygon(Tb)
L<-rbind(M,M,M); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
L<-rbind(M,M,M); R<-Tb
segments(L[,1], L[,2], R[,1], R[,2], lty=3,col=2)
xc<-Tb[,1]+c(-.04,.05,.04)
yc<-Tb[,2]+c(.02,.02,.03)
txt.str<-c("rv=1","rv=2","rv=3")
text(xc,yc,txt.str)
txt<-rbind(M,Ds)
xc<-txt[,1]+c(-.02,.03,-.03,0)
yc<-txt[,2]+c(-.02,.02,.02,-.03)
txt.str<-c("M","D1","D2","D3")
text(xc,yc,txt.str)
cp2e.bastri(c1,c2,M)
Run the code above in your browser using DataLab