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

📄 gmmouse.m

📁 matlab有限元分析工具,比经较全面的一个手册,请大家下载呀
💻 M
字号:
function brep = gmmouse% GMMOUSE: construct a brep from user-clicked in a graphics panel% brep = gmmouse  % Constructs a 2D brep by letting the user click points in the% drawing window that define the paths bounding the brep.global GM_BREP_TYPE_CODEthisfig = gmmouse1;radiocurrent = 1;allpoints = [];allcodes = [];set(thisfig,'pointer','crosshair')set(thisfig,'units','normalized')ax = findobj(thisfig,'tag','Axes1');set(ax,'units','normalized')radioh(1) = findobj(thisfig, 'tag','Radiobutton1');radioh(2) = findobj(thisfig, 'tag','Radiobutton2');radioh(3) = findobj(thisfig, 'tag','Radiobutton3');radioh(4) = findobj(thisfig, 'tag','Radiobutton4');beziersub_slider = findobj(thisfig, 'tag', 'Slider1');button_closeloop = findobj(thisfig, 'tag', 'Pushbutton1');button_done = findobj(thisfig, 'tag', 'Pushbutton2');button_cancel = findobj(thisfig, 'tag', 'Pushbutton3');while 1  loopdone = 0;  loop_pcount = 0;  prevpoint = [];  while ~loopdone    edgedone = 0;    while ~edgedone      curvedone = 0;      thiscurve = [];      if length(prevpoint) > 0        thiscurve = prevpoint;      end      while ~curvedone        keydown = waitforbuttonpress;        obj = get(thisfig, 'CurrentObject');	if length(obj) == 0        elseif obj == button_done          if strcmp(get(obj, 'enable'),'on')            delete(thisfig);            brep = gm_cpoly(allpoints, allcodes);            return          end        elseif obj == button_cancel          delete(thisfig);          error('No object created -- cancel button was pressed')        elseif obj == button_closeloop          if strcmp(get(obj, 'enable'),'on')            thiscurve = [thiscurve;loopstart];            curvedone = 1;            edgedone = 1;            loopdone = 1;          end        elseif any(radioh == obj)          if strcmp(get(obj, 'enable'),'on')            m = find(radioh == obj);            drawnow            set(radioh(radiocurrent),'value', 0);            if ~strcmp(computer, 'SOL2')              set(radioh(m),'value',1);            end            radiocurrent = m;          end        elseif obj == ax          pt = get(ax,'CurrentPoint');          x = pt(1,1);          y = pt(1,2);          plot(x,y,'og')          thiscurve = [thiscurve;[x,y]];          prevpoint = [x,y];          allpoints = [allpoints; [x,y]];          allcodes = [allcodes; (radiocurrent - 1)];          loop_pcount = loop_pcount + 1;          if loop_pcount == 3            set(button_closeloop,'enable','on');          end           if radiocurrent == 2 | radiocurrent == 3            curvedone = 1;          end          if radiocurrent == 1            radiocurrent = 2;            set(radioh(1),'value',0);            set(radioh(1),'enable','off');            loopstart = [x,y];            set(radioh(2),'enable','on');            set(radioh(2),'value',1);            set(radioh(3),'enable','on');            set(radioh(4),'enable','on');            set(button_closeloop, 'enable','off');            set(button_done, 'enable','off');          end        end      end      % draw the curve -- convert to a 1-edge brep      [degree, scrap] = size(thiscurve);      degree = degree - 1;      smallbrep = zba({GM_BREP_TYPE_CODE; 2; 2; {}; ...           thiscurve'; ...           {'v0', 'v1'; {}, {} ; {}, {} ; {}, {} ; ...             {'vertex';[];0}, {'vertex';[];degree}}; ...           {'e0';  {}; {'v0','v1'}; {}; {'bezier_curve';[degree];(0:degree)'}}; ...           {}});      beziersub = floor(get(beziersub_slider, 'value'));      [plist,simlist,scrap] = gm_vizp(smallbrep, zeros(1,4), 1, ...             beziersub);      [m,scrap] = size(simlist);      for j = 1 : m        sp = simlist(j,1) + 1;        ep = simlist(j,2) + 1;        plot([plist(sp,1),plist(ep,1)],[plist(sp,2),plist(ep,2)],'-k');      end    end  end  set(button_closeloop, 'enable','off');  set(button_done, 'enable','on');  for j = 2 : 4    set(radioh(j),'value', 0);    set(radioh(j),'enable','off');  end  set(radioh(1),'value', 1);  set(radioh(1),'enable','on');  radiocurrent = 1;end% ------------------------------------------------------------------% Copyright (c) 1999 by Cornell University.  All rights reserved.% See the accompanying file 'Copyright' for authorship information,% the terms of the license governing this software, and disclaimers% concerning this software.% ------------------------------------------------------------------% This file is part of the QMG software.  % Version 2.0 of QMG, release date September 3, 1999% ------------------------------------------------------------------

⌨️ 快捷键说明

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