def rotation_matrix(xangle, yangle, zangle, order='<STR_LIT>', degrees=False):
if degrees:<EOL><INDENT>xangle = math.radians(xangle)<EOL>yangle = math.radians(yangle)<EOL>zangle = math.radians(zangle)<EOL><DEDENT>c1 = math.cos(xangle) <EOL>c2 = math.cos(yangle) <EOL>c3 = math.cos(zangle) <EOL>s1 = math.sin(xangle)<EOL>s2 = math.sin(yangle)<EOL>s3 = math.sin(zangle)<EOL>if order=='<STR_LIT>':<EOL><INDENT>rot_mat = np.array([[c2*c3-s1*s2*s3, c2*s3+s1*s2*c3, -s2*c1],[-c1*s3, c1*c3, s1],[s2*c3+c2*s1*s3, s2*s3-c2*s1*c3, c2*c1]])<EOL><DEDENT>else:<EOL><INDENT>rot_mat = np.eye(<NUM_LIT:3>)<EOL>for i in range(len(order)):<EOL><INDENT>if order[i]=='<STR_LIT:x>':<EOL><INDENT>rot_mat = np.dot(np.array([[<NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:0>], [<NUM_LIT:0>,  c1, s1], [<NUM_LIT:0>, -s1, c1]]),rot_mat)<EOL><DEDENT>elif order[i] == '<STR_LIT:y>':<EOL><INDENT>rot_mat = np.dot(np.array([[c2, <NUM_LIT:0>, -s2], [<NUM_LIT:0>, <NUM_LIT:1>, <NUM_LIT:0>], [s2, <NUM_LIT:0>, c2]]),rot_mat)<EOL><DEDENT>elif order[i] == '<STR_LIT:z>':<EOL><INDENT>rot_mat = np.dot(np.array([[c3, s3, <NUM_LIT:0>], [-s3, c3, <NUM_LIT:0>], [<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:1>]]),rot_mat)<EOL><DEDENT><DEDENT><DEDENT>return rot_mat<EOL>
Compute the rotation matrix for an angle in each direction.
This is a helper function for computing the rotation matrix for a given set of angles in a given order.

:param xangle: rotation for x-axis.
:param yangle: rotation for y-axis.
:param zangle: rotation for z-axis.
:param order: the order for the rotations.