title: Compute Altitude and Azimuth from CMAttitude using either Roll, pitch and Yaw or Quaternion or Rotation Matrix
body: <p>I am struck with a problem. I want to convert the CMAttitude information of an iPhone to Altitude (0 to 90deg) and Azimuth (0 to 360 deg). I have googled around and hit some threads which discuss about it, but none of threads turn out with a positive answer and most of the articles discussing Quaternion and Euler angles are too much mathematics to stuff into my brain!</p>
  
  <p>Is there some open source material which does this task easy? Or someone has written code to perform this conversion?</p>
  
  <p>Edit:
  First off, sorry for being so abstract!</p>
  
  <p>Azimuth is the direction on the surface of the earth towards which the device is pointing. Like North = 0 deg, North East = 45deg, East = 90 deg, South = 180 deg and so on. Ranges between 0 deg to 360 deg:</p>
  
  <p><img src="https://i.stack.imgur.com/8aT4d.png" alt="enter image description here"></p>
  
  <p>Altitude is the angle made from the plane of the earth to an object in the sky:
  <img src="https://i.stack.imgur.com/FuAR7.gif" alt="enter image description here"></p>
  
  <p>Thanks,</p>
  
  <p>Raj</p>