So you have the three angles and can construct the rotation matrix. From this matrix, you can obtain the rotation axis to apply torque to. This axis is the eigenvector of the matrix. see
http://en.wikipedia.org/wiki/Rotation_matrix
Eigenvectors of a 3x3 matrix is, to my knowledge, found by iterative methods. However you can use a library for that purpose.