Math performance improvenents

getTempFalloff is used a lot of times and inside of three nested loops.
So I suggest to significantly reduce redundant math calculations. Note,
that the result values are not changed.