home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / PLOTXYZ.DI$ / HIDDEN.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  1.2 KB  |  56 lines

  1. function ret_type = hidden(onoff)
  2. %HIDDEN    Mesh hidden line removal mode.
  3. %    HIDDEN ON sets hidden line removal on for the current mesh.
  4. %    HIDDEN OFF sets hidden line removal off so you can see through
  5. %    the current mesh.
  6. %    HIDDEN by itself toggles the state of hidden line removal.
  7. %
  8. %    See also MESH.
  9.  
  10. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  11.  
  12. if nargin == 0
  13.     switch = 'tog';    % toggle hidden state
  14. else
  15.     switch = lower(onoff);
  16. end
  17. hf = gcf;
  18. ax = gca;
  19. bkgd = get(hf,'Color');
  20. % get mesh handle
  21. hk = get(ax,'Children');
  22. hm = [ ];
  23. for i = 1:max(size(hk))
  24. % see if the object could be a mesh - must be a surface first.
  25.     if strcmp('surface',get(hk(i),'type'))
  26.         fc = get(hk(i),'facecolor');
  27. % see if the object could be a mesh.
  28.         if isstr(bkgd)
  29.             bkstr = bkgd;
  30.         else
  31.             bkstr = num2str(bkgd);
  32.         end
  33.         if isstr(fc)
  34.             fcstr = fc;
  35.         else
  36.             fcstr = num2str(fc);
  37.         end
  38.         if strcmp('none',fc) | strcmp(bkstr,fcstr)
  39. % okay - it's the mesh
  40.             hm = hk(i);
  41.             if strcmp(switch,'on')
  42.                 set(hm,'facecolor',bkgd);
  43.             elseif strcmp(switch,'off')
  44.                 set(hm,'facecolor','none');
  45.             else
  46.                 if strcmp(fc,'none')
  47.                     set(hm,'facecolor',bkgd);
  48.                 else
  49.                     set(hm,'facecolor','none');
  50.                 end
  51.             end
  52.             break;
  53.         end
  54.     end
  55. end
  56.