How can I directly calculate **rotation** about the X, Y, Z axes (not **position**), given the object **rotation** in spherical angles (phi, theta)?

e.g.,

r(x) = G1(x, y, z, phi, theta)

r(y) = G2(x, y, z, phi, theta)

r(z) = G3(x, y, z, phi, theta)

where r(u) is the rotation in radians or degrees in a plane normal to the u-axis and G1, G2, G3 are the necessary functions. For example, a vector elevated 45° with respect to the x-y plane that is over the x-axis has 0° rotation with respect (wrt) to the x-axis. However, when it is rotated to 90° (theta) around the z-axis its rotation wrt the x-axis becomes 45°. As theta goes to 180° the rotation wrt the **y-axis** becomes 135°.

My gut tells me the Gi are continuous functions unless they include tangent functions (which I bet they do: what is the angle of rotation with the x-axis when theta=0? Is is 0 90° or infinity?)

Much googling so far without success: All the posts I’ve seen say to convert Cartesian coordinates to Spherical, do the rotation in phi, theta, then convert back to Cartesian. That doesn’t work for Blender since all it gives you is the new Cartesian translation coordinates x’, y’, z’. Blender requires both the new x’, y’, z’ AND the **amount** of angular rotation around the X, Y, Z axes.

I can easily calculate x’, y’, z’ given the old x, y, z given the amount of rotation in x-y plane (theta) and elevation above x-y plane (phi). But converting these spherical rotations to orthogonal rotations about the XYZ axes escapes me.

Thanks in advance.

Cheers, Andy