Is this frame straight?

Sign in to queue

Description

Preview[1]

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

Add Your 2 Cents