(Oops! I originally posted this on the iPhone Programming board; I meant to post it here. Sorry about that.)
I’m a bit confused about the coefficients used in the low-pass filter on page 152. Here’s the code as printed in the book:
float xShift = [hv xShift] * 0.8 + [accel x] * 2.0; float yShift = [hv yShift] * 0.8 - [accel y] * 2.0;
So the coefficient of the [hv *Shift] term is 0.8 and the coefficient of the [accel *] term is 2.0. But according to the “for the more curious” discussion on filtering, the sum of the coefficients should be 1.0, right? Should the coefficient on the [accel *] term be 0.2 instead of 2.0?