Smoothing Trajectories by Regularization