Description Usage Arguments Value Note Author(s) See Also Examples
Convert a quaternion to and from an equivalent orthogonal matrix
1 2 |
M |
A three-by-three orthogonal matrix |
Q |
A vector of quaternions |
Function matrix2quaternion()
returns a quaternion.
Function as.orthogonal()
returns either a 3*3
matrix or a 3*3*n array of orthogonal matrices
Function matrix2quaternion()
is low-level; use
as.quaternion()
to convert arrays.
Robin K. S. Hankin
1 2 3 4 5 6 7 8 9 10 11 12 13 | as.orthogonal(rquat(1))
o <- function(w){diag(3)-2*outer(w,w)/sum(w^2)} # Householder
matrix2quaternion(o(1:3)) # Booorrrriiinnnggg
matrix2quaternion(o(1:3) %*% o(3:1))
Q <- rquat(7)
Q <- Q/abs(Q)
as.quaternion(as.orthogonal(Q)) # +/- Q
A <- replicate(7,o(rnorm(3)) %*% o(rnorm(3)))
max(abs(as.orthogonal(as.quaternion(A))-A))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.