Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am struck with a mathematical problem. I want to convert the iPhone device's attitude information which is available in one of the following forms:

  1. Quaternion
  2. Rotation Matrix
  3. Roll, Pitch and Yaw component

To, Altitude and Azimuth. Where:

  • Altitude should be between: 0 to 90 deg and / or 0 to -90 deg. which depicts the altitude of the object pointed by the device in the sky.

enter image description here

  • Azimuth between 0 to 360 deg. which depicts the direction. North being 0 deg, South being 180 deg. etc. enter image description here

I am no expert at mathematics, so guys help me in figuring out this problem. I have already posted this question in sister website without much help. Probably because it involves too much of mathematics.

Thanks & Regards,


share|cite|improve this question
In order to determine the altitude and azimuth angle of your iphone, you need define a 3D reference frame first. But even if you have the frame, I'm afraid you still are not able to get the altitude and azimuth given the attitude of your iPhone. The attitude just tell you how your iphone rotates, but can not tell you how it translates. – Shiyu Apr 27 '11 at 14:56
The attitude tells the current state of the iPhone. It tells what are the Roll, pitch and yaw component. Now, lets say that the 3D reference frame is the same as that of the iPhone's initial position, isnt it possible to find the altitude and azimuth of the object in the sky which is pointed by the device? – Raj Pawan Gumdal Apr 28 '11 at 5:37
I guess the device, object and iphone you mentioned are the some thing, right? If you know the position of the iphone as well as the origin of the reference frame, you can calculate the azimuth and altitude of the iphone. But I don't think the attitude is helpful. – Shiyu Apr 28 '11 at 8:13
The object here is not known to me and that is what I have to find out what objects are visible if the iPhone is pointed in that direction in the sky. All I know is: 1. The attitude of the device (pitch, roll & yaw or Quaternion or Rotation Matrix). 2. The reference frame. Am I not clear yet? Thanks for your inputs and interest. – Raj Pawan Gumdal Apr 28 '11 at 8:15
For example, align the vector (i.e., arrow) with x-axis initially. The vector is $v_1=[1,0,0]^T$. After a rotation, the vector is $v_2=Rv_1=[x,y,z]^T$ where $R$ is the rotation matrix. Then the altitude is $\alpha=arctan(z/\sqrt{x^2+y^2})$. The azimuth is $\beta=arctan(y/x)$. – Shiyu Apr 29 '11 at 13:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.