# NOT RUN {
c1<-.4; c2<-.6;
A<-c(0,0); B<-c(1,0); C<-c(c1,c2);
Tb<-rbind(A,B,C)
n<-20
set.seed(1)
dat<-runif.bastri(n,c1,c2)$g
Ext<-cl2CC.TbVR(dat,c1,c2)
Ext
summary(Ext)
plot(Ext)
cl2CC.TbVR(dat[1,],c1,c2)
c2CC<-cl2CC.TbVR(dat,c1,c2)
CC<-circ.cent.bastri(c1,c2) #the circumcenter
D1<-(B+C)/2; D2<-(A+C)/2; D3<-(A+B)/2;
Ds<-rbind(D1,D2,D3)
Xlim<-range(Tb[,1],dat[,1])
Ylim<-range(Tb[,2],dat[,2])
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)
L<-matrix(rep(CC,3),ncol=2,byrow=TRUE); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
points(dat)
points(c2CC$ext,pch=4,col=2)
txt<-rbind(Tb,CC,Ds)
xc<-txt[,1]+c(-.03,.03,.02,.07,.06,-.05,.01)
yc<-txt[,2]+c(.02,.02,.03,-.01,.03,.03,-.04)
txt.str<-c("A","B","C","CC","D1","D2","D3")
text(xc,yc,txt.str)
cl2CC.TbVR(dat,c1,c2)
cl2CC.TbVR(c(.4,.2),c1,c2)
dat.fr<-data.frame(a=dat)
cl2CC.TbVR(dat.fr,c1,c2)
dat2<-rbind(dat,c(.2,.4))
cl2CC.TbVR(dat2,c1,c2)
cl2CC.TbVR(dat2,c1,c2,ch.all.intri = FALSE)
#gives an error message if ch.all.intri = TRUE
#since not all points are in the basic triangle
# }
Run the code above in your browser using DataLab