   Smoothing a value over time
  I''m working on a VR game app, and I''ve finally got head orientation data coming from my HMD in terms of rotation about the X,Y and Z axes.The data coming in is fairly noisy: If I hold my head as still as possible, the image before me is "shaky" - it moves around in small apparently random "jumps".I used to have a magazine article that described a function that took samples over time and returned an approximated, smoothed value - but I think I tossed out the magazine.Can someone please post a code snippet that accomplishes this? 
  Progressive averaging? Maintain an accumulator and a value count, and use the result of accumulator/count as your heading value. You''ll have to reset both every once in a while, to guard against overflow. ;  1. Take the mean of the last n samples?(Off the top of my head I can see several ways of optimising this; for small values of n possibly unnecessary)2. Take the weighted mean of the last sample and the result from the previous cycle''s calculation:  V'' = (V * (1-c)) + (n*c);V is the value to display and n is the input value?Where c is some constant between 0 and 1 (probably closer to 0)Essentially the effect of a given reading falls off exponentially or something. There is probably a name for this but I don''t know what it is.Mark ;  Perfect. Exactly what I needed! I will check out both methods!