Converting spherical rotation to cartesian rotation?

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

ok tell you tell us why you need this info and what do you want to do !

and not certain why you have spherical coordinates in first place

salutations

Hi thanks,

>Why

in order to place an object at a specific coordinate with a specific orientation.

The object’s position is defined by a Cartesian position of its centroid, its orientation is defined by a specific value of phi (elevation) and theta (rotation around z-axis).

But Blender does not allow entering values for phi and theta AFAICT. It only offers entry fields for Location, Rotation, and Scale in the Transform section of Object Properties.

And there the rotation must be specified for X, Y, and Z for any of the Euler permutations or W,X,Y,Z for Axis Angle or Quaternion rotation modes. There is no option I can find that permits entering elevation angle. Theta of course is rotation around the z-axis, so not a problem. The problem is converting phi, as I described: if theta is zero or 180° the the phi rotation is entirely around the y axis; if theta is 90° or 270° then the phi rotation is entirely around the x-axis. but anywhere else…???

Thanks again. Andy

not certain where you got these models in spherical coordinates

but blender works only with rectangular coordinates

now here do you have more the one set of coordinates
like global location in spherical coordinate in space and also some local coordinates for an object like local rotation?

so there are some conversion from spherical to rectangular coordinates
but you have to find the math for these conversions!

i’v seen some formulas in the wiki pages
but don’t remember for the angles
and there should be a formula for rotation too!

let us know how it goes !

hope it helps