In the matlib package https://github.com/friendly/matlib/ , I have the vectors3d() function for drawing geometric vector diagrams.
The following code gives an example showing the unit vector "J" and some of its projections on the X, Y, Z axis. When calling segments3d each argument is a 2 x 3 matrix giving the coordinates of the beginning and end.
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)

I want to add to this the straight angular lines, for example |_ , to show that the pairs of vectors that I draw using segments3d are orthogonal. I drew them by hand in the following figure. But I do not know how to calculate the small line segments needed for a given pair of vectors in this form, say, v1 and v2 . I am ready to assume that each segment length |_ is a small number, such as 0.05. 
EDIT: The task boils down to this: Given the three points p1 , p2 , p3 , find the points marked p21 , p23 and p123 in the diagram below. The first two are simple examples of finding a point along a line between two points, but I'm confusing finding the coordinates of a third point, p123 , that is, the position of a point at a distance d along a line parallel to the line p2->p3 starting from p21 .

In r that i still
This gives me the following diagram. Can someone help me fill it out?
