rgl vector diagrams: show right angles for orthogonal vectors
In the matlib package, https://github.com/friendly/matlib/ , I have a function, vectors3d() to draw geometric vector diagrams. The following code gives an example figure showing a unit vector "J" and some of its projections on the X, Y, Z axes. In the calls to segments3d , each argument is a 2 x 3 matrix giving start/end coordinates. if (!require(matlib)) devtools::install_github(friendly/matlib) library(matlib) library(rgl) vec <- rbind(diag(3), c(1,1,1)) rownames(vec) <- c("X", "Y", "Z", "J") open3d() vectors3d(vec, col=c(rep("black",3), "red"), lwd=2) # draw the XZ plane, whose equation is