# NOT RUN {
A<-c(1,2,3); B<-c(3,9,12); C<-c(1,1,3); P<-c(5,2,40)
dis<-dp2pl(P,A,B,C);
dis
Pr<-dis$Pr2pl #projection on the plane
P2<-c(0,0,0)
dp2pl(P2,A,B,C);
dp2pl(A,A,B,C);
xseq<-seq(0,10,l=20) #try also l=100
yseq<-seq(0,10,l=20) #try also l=100
pl.grid<-Plane(A,B,C,xseq,yseq)$z
plot3D::persp3D(z = pl.grid, x = xseq, y = yseq, theta =225, phi = 30, ticktype = "detailed")
#plane spanned by points A, B, C
#add the vertices of the tetrahedron
plot3D::points3D(P[1],P[2],P[3], add=TRUE)
plot3D::points3D(Pr[1],Pr[2],Pr[3], add=TRUE)
plot3D::segments3D(P[1], P[2], P[3], Pr[1], Pr[2],Pr[3], add=TRUE,lwd=2)
plot3D::text3D(P[1]-.5,P[2],P[3]+1, c("P"),add=TRUE)
plot3D::text3D(Pr[1]-.5,Pr[2],Pr[3]+2, c("Pr"),add=TRUE)
persp(xseq,yseq,pl.grid, xlab="x",ylab="y",zlab="z",theta = -30,
phi = 30, expand = 0.5, col = "lightblue",
ltheta = 120, shade = 0.05, ticktype = "detailed")
dp2pl(P,A,B,C)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab