title: Converting G Force data to rotation?
body: <p><br>
  I've been playing around with an accelerometer with 3 axis: X, Y and Z. It says on the <a href="http://www.parallax.com/tabid/768/ProductID/97/Default.aspx" rel="nofollow">supplier's site</a> that it measures gravitational force.</p>
  
  <p>I'm sending this data to the blender games engine where I am rotating a cube in real time depending on the data values coming from the accelerometer. However the values coming through don't seem to match up.</p>
  
  <p>On each axis the accelerometer spits out values from -700 to 700 on each axis and I need to convert these values to something I can use in Blender. My maths knowledge is not up to scratch so I don't know where to start with this one.</p>
  
  <p>If anybody could shed some light on this, that would be great.</p>
  
  <p>Many thanks<br>
  Will</p>
  
  <p><strong>EDIT</strong>
  Currently I'm using a bit of python code to convert the rotation values to a matrix: </p>
  
  <pre><code>def reorient(alpha, beta, gamma):
    a = math.cos(alpha) 
    b = math.sin(alpha) 
    c = math.cos(beta) 
    d = math.sin(beta) 
    e = math.cos(gamma) 
    f = math.sin(gamma)    
    ad = a*d 
    bd = b*d 
    matrix = [[c*e, -a*f+b*d*e, b*f+a*d*e], [c*f, a*e+b*d*f, -b*e+a*d*f], [-d, b*c, a*c]]
    return matrix 
  </code></pre>
  
  <p>I am then using setOrientation(matrix) to affect the rotation of the cube. However I am currently throwing the wrong values into the matrix reorient() function</p>