Cartesian to spherical polar coordinates

Click For Summary
SUMMARY

This discussion focuses on converting Cartesian coordinates to spherical polar coordinates, specifically addressing the transformation of angles THETA and PHI. The formulas used are theta = arccos(z) and phi = arcsin(y/sin(theta)). A key issue raised is the limitation of the arccos function, which returns values only between 0 and π, while the desired THETA values range from 0 to 2π. The solution involves using the signs of x and y to determine the correct quadrant for phi, thus enabling the transformation to yield values in the full 0 to 360-degree range.

PREREQUISITES
  • Understanding of Cartesian and spherical coordinate systems
  • Familiarity with trigonometric functions: arccos and arcsin
  • Knowledge of Euler angles and their application in 3D transformations
  • Basic skills in handling angles and quadrants in trigonometry
NEXT STEPS
  • Research the use of atan2 function for angle determination in quadrants
  • Explore spherical coordinate transformations in 3D graphics programming
  • Learn about the mathematical properties of Euler angles
  • Study the implications of angle wrapping in coordinate transformations
USEFUL FOR

Mathematicians, physicists, computer graphics developers, and anyone working with 3D coordinate transformations will benefit from this discussion.

birdhen
Messages
31
Reaction score
0
Hi there,
I am getting confused about how to work this out.
I know that to convert cartesian coordinates to spherical coordinates you can use:
theta=arccos(z)
phi=arcsin(y/sin(theta))

my problem is that I have a list of coordinates, let's call them THETA and PHI. I change them into X,Y,Z and then rotate them by 2 Euler angles.
THETA is in the range(0->2pi)
PHI is in the range (-pi/2->pi/2).

the problem is once I have completed the transforms I want the new value theta, As it is found using arccos the value returned is only in the range 0->pi, the values come back between 0 and 180, where as the THETA values are between 0 and 360, and therefore I want my transformed values to be in the range 0 to 360. I think I need to use quadrants but I have been searching the internet and can't find the info I need.

Any help would be greatly appreciated.
 
Mathematics news on Phys.org
Hi birdhen! :smile:

(have a theta: θ and a phi: φ and a pi: π and a degree: º :wink:)
birdhen said:
theta=arccos(z)
phi=arcsin(y/sin(theta))

my problem is that I have a list of coordinates, let's call them THETA and PHI. I change them into X,Y,Z and then rotate them by 2 Euler angles.
THETA is in the range(0->2pi)
PHI is in the range (-pi/2->pi/2).

I normally do it the other way round …

θ from -π/2 to π/2, and φ from 0 to 2π …

then you have x = rsinθcosφ, y = rsinθsinφ, so you can use x as well as y to work out what φ is. :smile:
 
ah, thank you,
so y/x=tanφ,
and the value of φ will depend on whether x and y are negative or positve.

Wonderful, that was the hint I needed,

Thank you!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K