I'm having trouble understanding the arguments for rgl::plane3d
required to draw a plane spanned by two vectors (x0, x1), going through a given point (O=origin). This is for a diagram explaining projection.
The rgl documentation doesn't provide enough examples for me to understand what to specify.
Here is my MWE:
library(matlib)
library(rgl)
rgl::open3d()
O <- c(0, 0, 0)
x0 <- c(1, 1, 1)
x1 <- c(0, 1, 1)
y <- c(1, 1, 3)
XX <- rbind(x0=x0, x1=x1)
matlib::vectors3d(XX, lwd=2)
matlib::vectors3d(y, labels=c("", "y"), color="red", lwd=3)
# how to specify the plane spanned by x0, x1 ???
# planes3d(..., col="gray", alpha=0.2)
# draw projection of y on plane of XX
py <- matlib::Proj(y, t(XX))
rgl::segments3d(rbind( y, py))
rgl::segments3d(rbind( O, py))