# NOT RUN {
normalize <- function(v) v/sqrt(sum(v^2))
# These vectors all have the same length
from <- t(apply(matrix(rnorm(9), ncol = 3), 1, normalize))
to <- normalize(rnorm(3))
center <- c(0, 0, 0)
open3d()
spheres3d(center, radius = 1, col = "white", alpha = 0.2)
arc3d(from, to, center, col = "red")
arc3d(from, 2*to, center, col = "blue")
text3d(rbind(from, to, center, 2*to),
text = c(paste0("from", 1:3), "to", "center", "2*to"),
depth_mask = FALSE, depth_test = "always")
# }
Run the code above in your browser using DataLab