?? frac_treegui.m
字號:
% 關于分形樹的GUI
% reference:
% http://id.mind.net/~zona/mmts/geometrySection/fractals/tree/treeFractal.html
close all
figure('position',[135 105 646 342]);
s1='Starting size = ';
s2='Minimum Size = ';
s3='Shrink Factor = ';
s4='Angle = ';
ss=69.0;
ms=4.0;
sf=1.85;
A=40.0; % 各參數的初值
axes('position',[0.5,0.1,0.45,0.8])
Fractree(ss,ms,sf,A);
set(gcf,'DoubleBuffer','on');
h1=uicontrol(gcf,'style','slider',...
'unit','normalized','position',[0.02,0.7,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
'SliderStep',[0.01,0.01],'callback',['a=get(h1,''value'');',...
'ss=fix(10+189*a);','set(t1,''string'',[s1,num2str(ss)]);',...
'Fractree(ss,ms,sf,A);'],'value',(ss-10)/189);
t1=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.02,0.75,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
'string','Starting size = 69.0');
h2=uicontrol(gcf,'style','slider',...
'unit','normalized','position',[0.02,0.6,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
'SliderStep',[0.01,0.01],'callback',['a=get(h2,''value'');',...
'ms=fix(1+48*a);','set(t2,''string'',[s2,num2str(ms)]);',...
'Fractree(ss,ms,sf,A);'],'value',(ms-1)/48);
t2=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.02,0.65,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
'string','Minimum Size = 4.0');
h3=uicontrol(gcf,'style','slider',...
'unit','normalized','position',[0.02,0.5,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
'SliderStep',[0.01,0.01],'callback',['a=get(h3,''value'');',...
'sf=fix(150+349*a)/100;','set(t3,''string'',[s3,num2str(sf)]);',...
'Fractree(ss,ms,sf,A);'],'value',(sf*100-150)/349);
t3=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.02,0.55,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
'string','Shrink Factor = 1.85');
h4=uicontrol(gcf,'style','slider',...
'unit','normalized','position',[0.02,0.4,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','r',...
'SliderStep',[0.01,0.01],'callback',['a=get(h4,''value'');',...
'A=fix(179*a);','set(t4,''string'',[s4,num2str(A)]);',...
'Fractree(ss,ms,sf,A);'],'value',A/179);
t4=uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.02,0.45,0.4,0.04],...
'BackgroundColor',[0.8 0.8 0.8],'ForegroundColor','b',...
'string','Angle = 40.0');
uicontrol(gcf,'style','text',...
'unit','normalized','position',[0.04,0.85,0.3,0.12],...
'BackgroundColor',[0.8 0.8 0.9],'ForegroundColor','r',...
'string','Fractal tree V1.0','fontsize',16,...
'fontname','new times roman');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -