powered by
Get a unit quaternion whose corresponding rotation sends u to v; the vectors u and v must be normalized.
u
v
quaternionFromTo(u, v)
A unit quaternion whose corresponding rotation transforms u
to v.
two unit 3D vectors
library(qsplines) u <- c(1, 1, 1) / sqrt(3) v <- c(1, 0, 0) q <- quaternionFromTo(u, v) rotate(rbind(u), q) # this should be v
Run the code above in your browser using DataLab