move duplicate code into calculateInterpolatedPosition()