# NOT RUN {
A<-c(1,1); B<-c(2,0); C<-c(1.5,2);
Tr<-rbind(A,B,C);
r<-1.35
cent<-2
P<-c(1.4,1.0)
rverts.tri.nd(P,Tr,r,cent)
P<-c(1.8,.5)
rverts.tri.nd(P,Tr,r,cent)
P<-c(10.5,1.6)
rverts.tri.nd(P,Tr,r,cent)
n<-10 #try also n<-20
set.seed(1)
dat<-runif.tri(n,Tr)$g
rverts.tri.nd(dat,Tr,r,cent)
rverts.tri.nd(rbind(dat,c(2,2)),Tr,r,cent)
rv<-rverts.tri.nd(dat,Tr,r,cent)
M<-cent.nondeg(Tr,r)[cent,];
Ds<-cp2edges.nd(Tr,r,cent)
Xlim<-range(Tr[,1],dat[,1])
Ylim<-range(Tr[,2],dat[,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)
points(dat,pch=".",col=1)
L<-rbind(M,M,M); R<-Ds
segments(L[,1], L[,2], R[,1], R[,2], lty=2)
xc<-Tr[,1]+c(-.03,.05,.05)
yc<-Tr[,2]+c(-.06,.02,.05)
txt.str<-c("rv=1","rv=2","rv=3")
text(xc,yc,txt.str)
txt<-rbind(M,Ds)
xc<-txt[,1]+c(.02,.04,-.03,0)
yc<-txt[,2]+c(.07,.03,.05,-.07)
txt.str<-c("M","D1","D2","D3")
text(xc,yc,txt.str)
text(dat,labels=factor(rv$rv))
P<-c(1.4,1.0)
rverts.tri.nd(P,Tr,r,cent)
rverts.tri.nd(dat,Tr,r,cent)
rverts.tri.nd(rbind(dat,dat),Tr,r,cent)
dat.fr<-data.frame(a=dat)
rverts.tri.nd(dat.fr,Tr,r,1)
dat.fr<-data.frame(a=Tr)
rverts.tri.nd(dat,dat.fr,r,1)
# }
Run the code above in your browser using DataLab