I am trying to translate theta and phi rotation in Blender to the Euler XYZ rotation about each axis. To do this I am currently using the following code: """
def Sphere2Euclid(theta, phi):
"""
Inputs: theta - Angle as defined in the GA
phi - Angle as defined in the GA
Outputs: x - The x rotation angle in Euler Angle Coordinates
y - The y rotation angle in Euler Angle Coordinates
z - The z rotation angle in Euler Angle Coordinates
Description: This function will take the theta and phi angles as defined in the NEBULOUS Genetic AlgorithmGA and convert them to Euler Coordinates
Source for conversion: https://blender.stackexchange.com/questions/158377/object-rotation-with-polar-angles-python
"""
x = math.sin(math.radians(theta)) * math.cos(math.radians(phi))
y = math.sin(math.radians(theta)) * math.sin(math.radians(phi))
z = math.cos(math.radians(phi))
return x, y, z
This current code doesn't seem to rotation from a global orientation as it does not produce the correct orientation for testing angles. Is my method of converting from theta and phi to XYZ wrong or am I fundamentally misunderstanding how blender handles rotation?