Minimum-time velocity planning with arbitrary boundary conditions