Relative compression of trajectories