title: Implement a Kalman filter to smooth data from deviceOrientation API
body: <p>I'm trying to smooth the data I'm getting from the deviceOrientation API to make a Google Cardboard application in the browser. </p>
  
  <p>I'm piping the accelerometer data straight into the ThreeJs camera rotation but we're getting a lot of noise on the signal which is causing the view to judder. </p>
  
  <p>Someone suggested a Kalman filter as the best way to approach smoothing signal processing noise and I found this simple Javascript library on gitHub</p>
  
  <p><a href="https://github.com/itamarwe/kalman" rel="noreferrer">https://github.com/itamarwe/kalman</a></p>
  
  <p>However its really light on the documentation. </p>
  
  <p>I understand that I need to create a Kalman model by providing a Vector and 3 Matrices as arguments and then update the model, again with a vector and matrices as arguments over a time frame.</p>
  
  <p>I also understand that a Kalman filter equation has several distinct parts: the current estimated position, the Kalman gain value, the current reading from the orientation API and the previous estimated position. </p>
  
  <p>I can see that a point in 3D space can be described as a Vector so any of the position values, such as an estimated position, or the current reading can be a Vector.</p>
  
  <p>What I don't understand is how these parts could be translated into Matrices to form the arguments for the Javascript library.</p>