added a debug function to print a trajectory.