# NOT RUN {
n<-5
set.seed(1)
dat<-rbind(runifTe.onesixth(n)$gen.points,runifTe(n)$gen.points)
Gam1CS.Te.onesixth(dat[1,],dat[2,])
Gam1CS.Te.onesixth(c(.2,.5),dat[2,])
Gam1CS.Te.onesixth(c(.2,.5),c(.2,.5))
Gam1CS.Te.onesixth(dat[2,],dat)
Gam1CS.Te.onesixth(dat[9,],dat)
Gam1CS.Te.onesixth(c(.49,.49),dat)
n<-nrow(dat)
gam.vec<-vector()
for (i in 1:n)
{gam.vec<-c(gam.vec,Gam1CS.Te.onesixth(dat[i,],dat))}
ind.gam1<-which(gam.vec==1)
ind.gam1
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C)
CM<-(A+B+C)/3;
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)
Xlim<-range(Te[,1])
Ylim<-range(Te[,2])
xd<-Xlim[2]-Xlim[1]
yd<-Ylim[2]-Ylim[1]
plot(Te,pch=".",xlab="",ylab="",axes=TRUE,xlim=Xlim+xd*c(-.05,.05),ylim=Ylim+yd*c(-.05,.05))
polygon(Te)
L<-matrix(rep(CM,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
segments(L[,1], L[,2], Te[,1], Te[,2], lty=2)
polygon(rbind(A,D3,CM))
points(dat,pch=1,col=1)
points(rbind(dat[ind.gam1,]),pch=4,col=2)
txt<-rbind(A,B,C,CM,D1,D2,D3)
xc<-txt[,1]+c(-.02,.02,.01,.05,.04,-.03,.03)
yc<-txt[,2]+c(.02,.02,.03,-.02,.03,.02,-0.04)
txt.str<-c("A","B","C","CM","D1","D2","D3")
text(xc,yc,txt.str)
Gam1CS.Te.onesixth(c(.4,.1),c(.4,.1))
Gam1CS.Te.onesixth(c(.49,.19),c(.4,.1))
Gam1CS.Te.onesixth(c(.4,.2),dat)
dat.fr<-data.frame(a=dat)
Gam1CS.Te.onesixth(c(.4,.2),dat.fr)
Gam1CS.Te.onesixth(c(.49,.49),dat,ch.data.pnt = TRUE)
#gives an error message since point, p, is not a data point in Dt
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab