*********************************************************************sdk ************************************************************************ * * Subroutine POLAR2MTX * * Function: * Convert polar angles to rotation matrix * * Comments: * Definition of angles: * * Kappa is the clockwise rotation around the rotation axis looking * away from the origin. * Phi is the angle between the x axis and the projection of the rotation * axis on the xy plane. A positive rotation is a clockwise rotation when * looking down the z axis. * Omega is the angle between the z axis and the rotation axis. * * * Arguments: * Omega (i) omega angle in degrees * Phi (i) phi angle in degrees * Kappa (i) kappa angle in degrees * Rot (o) 3 x 3 rotation matrix * * * History: * Subroutine from standalone program February 13 1992 sdk * Written February 1990 S. Knight ************************************************************************ subroutine polar2mtx ( omega , phi , kappa , rot ) implicit none * Arguments real omega , phi , kappa , rot(3,3) * Local variables integer i , j double precision domega , dphi , dkappa , r(3,3) double precision atr , a1 , a2 , a3 , a4 , a5 , a6 parameter (atr = 3.141592653589793/180.) *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= * Convert to radians and double precision domega = atr * omega dphi = atr * phi dkappa = atr * kappa * a1,a2,a3 = direction cosines of rotation axis a1 = sin ( domega ) * cos( dphi ) a2 = sin ( domega ) * sin( dphi ) a3 = cos ( domega ) a4 = sin ( dkappa ) a5 = cos ( dkappa ) a6 = 1 - a5 * First row r(1,1) = a5 + a6 * a1**2 r(1,2) = a1 * a2 * a6 - a3 * a4 r(1,3) = a1 * a3 * a6 + a2 * a4 * Second row r(2,1) = a1 * a2 * a6 + a3 * a4 r(2,2) = a5 + a6 * a2**2 r(2,3) = a2 * a3 * a6 - a1 * a4 * Third row r(3,1) = a1 * a3 * a6 - a2 * a4 r(3,2) = a2 * a3 * a6 + a1 * a4 r(3,3) = a5 + a6 * a3**2 * Copy result do 20 j = 1 , 3 do 10 i = 1 , 3 rot( i,j ) = r( i,j ) 10 continue 20 continue return *=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= end