The tip of the red giant branch and distance of the Magellanic Clouds: results from the DENIS survey