quaternionFromTo {qsplines} | R Documentation |
Quaternion between two vectors
Description
Get a unit quaternion whose corresponding rotation sends
u
to v
; the vectors u
and v
must be normalized.
Usage
quaternionFromTo(u, v)
Arguments
u , v |
two unit 3D vectors |
Value
A unit quaternion whose corresponding rotation transforms u
to v
.
Examples
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
[Package qsplines version 1.0.1 Index]