# Cartesian to Spherical coordinates Calculator

## Converts from Cartesian (x,y,z) to Spherical (r,θ,φ) coordinates in 3-dimensions. | ||

- Purpose of use
- Writing computer graphics software.

[1] 2018/12/13 23:42 Male / 20 years old level / Self-employed people / Very /

- Purpose of use
- Check work

[2] 2018/08/29 00:07 Male / 20 years old level / High-school/ University/ Grad student / Very /

- Purpose of use
- homework
- Comment/Request
- explanation

[3] 2018/05/07 19:40 Male / 20 years old level / High-school/ University/ Grad student / Very /

- Purpose of use
- for mapping

[4] 2018/03/13 12:30 Male / 40 years old level / An office worker / A public employee / Very /

- Purpose of use
- Seventeenth source to verify equations derived from first-principles.
- Comment/Request
- Comment 14 had a point on the calculation of phi, though he was incorrect in claiming that your equation is "wrong". Your equation is correct but degenerate in that it suffers from gimbal-lock. Your solution for theta has a similar issue. For a solution free of both of these issues, use:

theta = atan2(y, x) % <- ***

% *** - Check implementation in whatever language you are using, most are

% denominator then numerator. Some are not.

phi = acos(z/r)

With this formulation the only degenerate case is a zero length radius, for which the angles are undefined. As such the input is degenerate and the output being degenerate follows.

[5] 2018/03/09 01:56 Male / 50 years old level / An engineer / Useful /

- Purpose of use
- hohmeworke
- Comment/Request
- how do you find theta when x = 0

[6] 2018/02/01 07:30 Male / Under 20 years old / High-school/ University/ Grad student / Useful /

- Purpose of use
- to Lerner
- Comment/Request
- i will like to you for ---

[7] 2017/12/20 23:22 Female / - / High-school/ University/ Grad student / Very /

- Purpose of use
- Checking my own hand calculations.
- Comment/Request
- Would be nice if you could factor pi out of radians and give answer in fractions when applicable.

[8] 2017/09/08 03:45 Male / 20 years old level / High-school/ University/ Grad student / Useful /

- Purpose of use
- testing a conversion algorithm I''m using in a programming project

[9] 2017/08/24 22:18 Male / Under 20 years old / High-school/ University/ Grad student / Useful /

- Purpose of use
- To check if my fortran routine performed correct rotation (it did!).

[10] 2017/08/02 22:41 Male / 30 years old level / A teacher / A researcher / Useful /

**To improve this 'Cartesian to Spherical coordinates Calculator', please fill in questionnaire.**

**The hyperlink to [Cartesian to Spherical coordinates]**