It's funny how a little math can simplify a function call

from 30 lines to 5 lines.

imported from: yetanothergeographer