c c ______________________ c subroutine q2eulB(p1,p,p2,qq) c c converts quaternion to Bunge Euler angles c based on Altmann's solution for Euler->quat c real qq(4),p1,p,p2 real sum,diff c PI=3.14159265 c diff=atan2(qq(2),qq(1)) sum=atan2(qq(3),qq(4)) p1=(diff+sum) p2=(sum-diff) tmp=sqrt(qq(3)**2+qq(4)**2) if(tmp.gt.1.0) tmp=1.0 p=2.*acos(tmp) c write(*,*) ' quaternion input= ',qq c write(*,*) 'Bunge angles output= ',p1,p,p2 c write(*,*) ' angles [degrees]= ',180.*p1/pi,180.*p/pi,180.*p2/pi return end c c ______________________ c