Optimal path planning for the capturing of a moving object