Time Optimal Motion Planning in Dynamic Environments