Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:38:42+00:00 2026-06-14T08:38:42+00:00

The iPhone gyroscope receives rotation data relative to some reference attitude and it doesn’t

  • 0

The iPhone gyroscope receives rotation data relative to some reference attitude and it doesn’t change (unless multiplied.) Lets say I face the wall using my iPhone camera, and rotate 45 degrees left (roll += PI/4.)

Now, if I lift the phone towards the ceiling, both yaw and pitch change since the coordinate space is fixed (world coordinate space, doesn’t move or rotate with the phone.) Is there a way to determine this angle (the one between the floor plane and the camera direction vector), roll, yaw and pitch given?

Edit: Instead of opening another question I’ll try here. Luc’s solution works. But how to get the other two angles of rotation? I’ve read the info on the posted link but it’s been years since I studied linear algebra. This might be more math than a programming question, actually.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:38:43+00:00Added an answer on June 14, 2026 at 8:38 am

    I don’t really code for iPhone so I’ll trust you on the “real world coordinates” frame.

    In that case, you want the dot product between both z-axis’ vectors. That’ll give you the cosine of the angle you’re looking for, pretty close thus. Since an angle between planes only really makes sense as a value between 0° and 90°, you actually have all the information you need in that cosine.

    And there is no latex formatting here, otherwise I’d go into a bit more of detail, but read this page if you’re interested, I’ll just include the final result here, the rotation matrix for your three rotations :
    rotation matrix

    Now the z-axis’ vector of the horizontal plan is (0,0,1) (read this as a vertical vector though) and rotated with this matrix, you simply get its third column.

    So we want to have the dot product between that third column and our (0,0,1) vector, so you get cos(β)cos(γ) which is cos(pitch)*cos(roll)

    In conclusion, the angle between your plans is arccos(cos(pitch)*cos(roll)). This value will tell you how much your iPhone is inclined, not in which direction of course. But you can work that out from the values of the vector (rightmost column of the matrix) we spoke of.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My iPhone app can't seem to use soft keyboards that doesn't use the US-like
Iphone changes some fonts making the site unproportional and not as originally designed. Is
iPhone Safari seems to have some sort of problem whereby a page with css
iPhone doesn't allow background processes to run, but is possible to get a notification
I've been experimenting with the compass and gyroscope on iPhone 4 and would like
How would I implement something that can make use of the iPhone 4's gyroscope
I am relatively new to iPhone development and I am playing with the gyroscope,
My iPhone app was rejected last week because of me not following iOS Data
iPhone/objC I'm really stuck here and I could use some help, please. Let me
I am a little confused about iPhone's accelerometer and gyro data. I had worked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.