Skip to main content
edited tags
Link
Harry McKenzie
  • 14.5k
  • 11
  • 34
  • 74
deleted 24 characters in body
Source Link

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?

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 Algorithm 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?

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 GA 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?

deleted 104 characters in body
Source Link

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 NEBULOUS Genetic Algorithm (in DEGREES OR RADIANSS?? )GA
            phi - Angle as defined in the NEBULOUS Genetic Algorithm (in DEGREES OR RADIANSS?? )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 Algorithm 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?

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 NEBULOUS Genetic Algorithm (in DEGREES OR RADIANSS?? )
            phi - Angle as defined in the NEBULOUS Genetic Algorithm (in DEGREES OR RADIANSS?? )

    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 Algorithm 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?

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 Algorithm 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?

Source Link
Loading