View source: R/quaternionFromTo.R
quaternionFromTo | R Documentation |
Get a unit quaternion whose corresponding rotation sends
u
to v
; the vectors u
and v
must be normalized.
quaternionFromTo(u, v)
u, v |
two unit 3D vectors |
A unit quaternion whose corresponding rotation transforms u
to v
.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.