%% Given ball positions and velocities, calculates the time to prepare that state.