⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sliceomaticmotion.m

📁 matlab宝典,电子工业出版社,包含该书的源码9-11章
💻 M
字号:
function sliceomaticmotion(fig,action)% Handle generic motion events for the figure window.% Copyright 2000, 2001, 2002, 2003, 2004, 2005 The MathWorks Inc  obj = hittest(fig);  % Some objects get a special pointer when the mouse waves  % over them.  Get it from appdata.  if ~isempty(obj)    t = getappdata(obj,'motionpointer');    cc = get(fig,'pointer');      if t      newc = t;    else      newc = get(0,'defaultfigurepointer');    end      if isa(newc,'char') && isa(cc,'char') && ~strcmp(newc,cc)      setpointer(fig, newc);    end  end    d = getappdata(fig,'sliceomatic');  % The motion meta slice is a line that is managed here.  % There is only one.  if isempty(d.motionmetaslice)    d.motionmetaslice = line('parent',d.axmain,...                             'vis','off',...                             'linestyle','--',...                             'marker','none',...                             'linewidth',2,...                             'erasemode','xor','clipping','off');    setappdata(fig,'sliceomatic',d);  end  showarrowtip(obj);    if isempty(obj) || (obj ~= d.axx && obj ~= d.axy && obj ~= d.axz)    set(d.motionmetaslice,'visible','off');        return  end    % OBJ can only be an Axes because of the previous IF statement.    aa = obj;  apos=get(aa,'currentpoint');  xl = d.xlim;  yl = d.ylim;  zl = d.zlim;    if aa==d.axx || aa==d.axiso    if aa==d.axiso      % eh?    else      xdata = [ apos(1,1) apos(1,1) apos(1,1) apos(1,1) apos(1,1) ];      ydata = [ yl(1) yl(2) yl(2) yl(1) yl(1) ];      zdata = [ zl(2) zl(2) zl(1) zl(1) zl(2) ];    end  else    % We are moving a Y or Z slice    if aa==d.axy      ydata = [ apos(1,2) apos(1,2) apos(1,2) apos(1,2) apos(1,2) ];      xdata = [ xl(1) xl(2) xl(2) xl(1) xl(1) ];      zdata = [ zl(2) zl(2) zl(1) zl(1) zl(2) ];    else      zdata = [ apos(1,2) apos(1,2) apos(1,2) apos(1,2) apos(1,2) ];      ydata = [ yl(1) yl(2) yl(2) yl(1) yl(1) ];      xdata = [ xl(2) xl(2) xl(1) xl(1) xl(2) ];    end  end  set(d.motionmetaslice,'visible','on',...                    'xdata',xdata,'ydata',ydata,'zdata',zdata);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -