The morphology of the Magellanic Clouds revealed by stars of different age: results from the DENIS survey