c c ______________________ c subroutine qrvec(qq,din,dout) c c uses quaternion to rotate a vector from DIN to DOUT; c note similarity to above routine c note that -q gives the same result as it should (represents same rotation) c real qq(4),din(3),dout(3) real t1 c t1=qq(4)**2-qq(1)**2-qq(2)**2-qq(3)**2 do 100, i=1,3 dout(i)=t1*din(i) c do 90, j=1,3 dout(i)=dout(i)+(2.*qq(i)*qq(j)*din(j)) c if(i.ne.j) then do 80, ijk=1,3 if(i.ne.ijk.and.j.ne.ijk) k=ijk 80 continue kl=j-i if(kl.eq.2) kl=-1 if(kl.eq.-2) kl=1 c poor man"s permutation tensor! dout(i)=dout(i)-(2.*qq(k)*qq(4)*float(kl)*din(j)) endif 90 continue 100 continue return end c c c _____________________________ c