Monday, April 20, 2009

DirectX Front-End finished

Today I finished the DirectX front end of my project. To be honest I should have thought of this in the first place.

First of all I can now display and simulate a real sphere with the artificial horizon on it, and I can rotate it pretty easily with rotation matrices from DirectX. Let me show you a picture and then comment on it:


Here you see a background PNG image file with transparency in the middle circle. Behind it is a sphere with a texture of an horizon wrapped around it.

Now, in DirectX or any other Graphics Engine API, the transformation of objects in a scene is done using Transformation matrices, for example: Translation, Scalling or Rotation. The last one is the one we are interested in, and since we normaly can move in 3-Dimensions, then it is normal that we have 3 kinds of Rotation Matrices, one for each axis. To combine the effect of any transformation matrices you just have to multiply them in the order you want them to take affect.

Therefore it is now standard arithmetics to convert the reading from the Accelerometer (3 Voltages for 3 axis of movement) to 3 Rotation Matrices which multiplyed give the relative position of the accelerometer board.

I now must add a CALIBRATE button to the scene, to remember the normal horizontal position, and implement an .ini file system for the hardware configuration. Wish me luck!

No comments: