Is this frame straight?



Joel Ivory Johnson created a rather functional program for his Zune HD.  Joel created a bubble level based on the accelerometer in the Zune HD to get the tilt of the device.  From that data and everyone's favorite theorem, he created a bubble level!

Joel also explains the math needed for doing this such as calculating the direction and the magnitude.

Vector3 accelReading = accelState.Acceleration;

tiltDirection = (float)Math.Atan2(accelReading.Y, accelReading.X);
tiltMagnitude = (float)Math.Sqrt(accelReading.X * accelReading.X + 
                 accelReading.Y * accelReading.Y );

The Discussion

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.