I think these 3 lines should be extracted to something like calculateFormationPosition(direction)