data(bunny)
par(mfrow=c(2,2))
par(mai=rep(0,4))
p3d(rotate(bunny,Hi),box=FALSE)
p3d(rotate(bunny,H1-Hi+Hj),box=FALSE)
p3d(rotate(bunny,Hk),box=FALSE)
p3d(rotate(bunny,Hall),box=FALSE)
o <- function(w){diag(3)-2*outer(w,w)/sum(w^2)} # Householder
O <- o(1:3) %*% o(3:1)
rotate(bunny,as.quaternion(O))
bunny %*% t(O) # should be the same; note transpose
Run the code above in your browser using DataLab