Is this frame straight?
- Posted: Dec 02, 2009 at 8:27 PM
- 220 Views
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 );