title: Calculate θ and ø angles between origin and x,y,z coordinate
body: <p>I'm using <a href="http://threejs.org/" rel="nofollow">three.js</a> for a small 3D POC project. The following snippet  calculates the new x,y,z position for a 3D object in orbit around the origin (0,0,0):</p>
  
  <pre><code>x = rho * Math.cos(theta) * Math.sin(phi);
  y = rho * Math.sin(theta) * Math.sin(phi);
  z = rho * Math.cos(phi);
  </code></pre>
  
  <p>In the above example, <em>theta</em> and <em>phi</em> are known and used to calculate the new x,y,z coordinate for the orbiting 3D subject.</p>
  
  <p>The above works well, but I also want to do the inverse.</p>
  
  <p>How do I go about calculating <em>theta</em> and <em>phi</em>, if I only have an x,y,z point, this all in relation to the origin point (0,0,0)?</p>