title: Convert x, y, z to heading and angle
body: <p>I am not so good at maths.</p>
  
  <p>I am converting the heading and angle to x, y, z coordinates using the below code.</p>
  
  <pre><code>double x  =-((1000/std::tan(DEG_TO_RAD(angle)))*std::sin(DEG_TO_RAD(heading)))/std::sqrt(std::pow(1000,2)+std::pow(((1000/std::tan(DEG_TO_RAD(angle)))*std::cos(DEG_TO_RAD(heading))),2)+std::pow(((1000/std::tan(DEG_TO_RAD(angle)))*std::sin(DEG_TO_RAD(180-heading))),2));
  double y = (1000/std::sqrt(std::pow(1000,2)+std::pow(((1000/std::tan(DEG_TO_RAD(angle)))*std::cos(DEG_TO_RAD(180-heading))),2)+std::pow(((1000/std::tan(DEG_TO_RAD(angle)))*std::sin(DEG_TO_RAD(180-heading))),2)))*(angle/std::sqrt(std::pow(angle,2)));
  double z =-((1000/std::tan(DEG_TO_RAD(angle)))*std::cos(DEG_TO_RAD(180-heading)))/std::sqrt(std::pow(1000,2)+std::pow(((1000/std::tan(DEG_TO_RAD(angle)))*std::cos(DEG_TO_RAD(180-heading))),2)+std::pow(((1000/std::tan(DEG_TO_RAD(angle)))*std::sin(DEG_TO_RAD(180-heading))),2));
  </code></pre>
  
  <p>I want to now do the reverse or is it even possible</p>