Reducing code repetition in the acceleration calc

Passing in the d3 rule as a function rather than having 2 nearly
identical functions for each.