Calculates the translation of a function, which can be horizontally, vertically, or both.