home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 3.ddi / DEMOS.DI$ / EARTHEX.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  722 b   |  28 lines

  1. %EARTHEX Used by EARTHMAP to generate relief view.
  2.  
  3. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  4.  
  5. disp('This takes about 3 minutes on a SPARC 2 ...')
  6. tic
  7.  
  8. % Set everything below sea level to zero.
  9. tland = topo.*(topo >= 0);
  10.  
  11. % Lighting data from two directions is averaged 
  12. % to provide the illusion of a relief map.
  13. az = 45;
  14. el = 10;
  15. disp('First lighting calculation ...')
  16. cdata = get(surfl(tland,[az,el]),'cdata');
  17. disp('Second lighting calculation ...')
  18. cdata = (cdata+get(surfl(tland,[-az,el]),'cdata'))/2;
  19.  
  20. % Texture map the lighting data onto the sphere.
  21. disp('Texture mapping ...')
  22. clf
  23. h = surface(x,y,z,'facecolor','texture','cdata',cdata); 
  24. view(3)
  25. axis square
  26. colormap(topomap2)
  27. toc
  28.