Predicted threshold against forward and backward loss of balance for perturbed walking