📄 fwin.asv
字号:
function noreturn=fwin(arg1, arg2, arg3);
% fwin : This program handles graph interface for fractal - an ATLAST
% workshop project: 2D/3D Fractal Pictures of Fern and Other Fractal Images!
% This project is developed by: Victor, Daniel, Henry, Herb, Zhang
% written by -- szhang@math.udel.edu
% Created: 7/1997
% Last modification: 9/2002
global sli_1 sli_1cur sli_2 sli_2cur fig cb_box popcol cpop tf np nv cm
global edp x pct figa
se='Style'; sg='String'; pn='Position'; ck='CallBack';ve='Value';
ut='Unit'; nd='normalized';
if (arg1 == 1 ),
figa=figure('MenuBar', 'none', 'NumberTitle','off',...
'Name', 'ATLAST Project: Fractal (pop-up window)',...
'Units', 'normalized'); clf(figa);
uicontrol(figa, se,'text',ut,nd,pn,[0.05 0.05 0.9 0.9],...
sg, { ' ',' ',...
' ATLAST Workshop Project ', ' ', ...
' Madison, Wisconsin -- August, 1997 ', ' ',' ',...
'Herbert C. Lyon, Black Hawk College',...
'Daniel Okunbor, University of Missouri-Rolla',...
'Victor Piotrowski, University of Wisconsin-Superior',...
'Henry J. Ricardo, Medgar Evers College(CUNY)',...
'Shangyou S. Zhang, University of Delaware', ' ',' ',...
'Copyright ATLAST Team, 1997, 2002',' ',' ', ' ',' ',...
'This Matlab programs applies linear and affine transformations to generate fractal images of some natural objects. For more information, please read ATLAST Computer Exercises for Linear Algebra, 2nd ed., or contact Shangyou Zhang at szhang@udel.edu. ',...
' ',...
' '},...
'BackgroundColor',[0.9 0.9 1.0]);
uicontrol(figa,se,'push',ut,nd,pn,[0.4 0.06 .2 .05], ...
sg,'Done',ck,'close(figa)');
end
if (arg1 == 2 ),
figa=figure('MenuBar', 'none', 'NumberTitle','off',...
'Name', 'ATLAST Project: Fractal (pop-up window)',...
'Units', 'normalized'); clf(figa);
uicontrol(figa, se,'text',ut,nd,pn,[0.05 0.05 0.9 0.9],...
sg, { ' ',' Affine Transformation ', ' ', ...
' [ u ] [ a b ] [ x ] [ e ] ',...
' [ ] = [ ] [ ] + [ ] ',...
' [ v ] [ c d ] [ y ] [ f ] ', ' ',' ',...
'An affine transformation is a combination of a linear transformation and a translation. The linear transformations, represented by 2x2 matrices, are rotations and contractions. Combining these with translations, we have the necessary tools to produce fractal images. ',' ',' ',...
'First, we define a basic graph so that Matlab can plot some points. Then on the next level, we apply affine transformations and produce many copies of the same graph, but of smaller size, of different orientation, and at different locations. After combining several levels of such graphs, we get the final fractal image. ',...
' '},...
'BackgroundColor',[0.9 1.0 0.9]);
uicontrol(figa,se,'push',ut,nd,pn,[0.4 0.06 .2 .05], ...
sg,'Done',ck,'close(figa)');
end
if (arg1 == 3 ),
figa=figure('MenuBar', 'none', 'NumberTitle','off',...
'Name', 'ATLAST Project: Fractal (pop-up window)',...
'Units', 'normalized'); clf(figa);
uicontrol(figa, se,'text',ut,nd,pn,[0.05 0.05 0.9 0.9],...
sg, { ' ',' ', ' ', ' ',' ', ' ',...
' Please contact Shangyou Scott Zhang at ', ' ',...
' szhang@udel.edu '},...
'BackgroundColor',[0.1 0.9 0.9]);
uicontrol(figa,se,'push',ut,nd,pn,[0.4 0.06 .2 .05], ...
sg,'Done',ck,'close(figa)');
end
if (arg1 == 41 ),
figa=figure('MenuBar', 'none', 'NumberTitle','off',...
'Name', 'ATLAST Project: Fractal (pop-up window)',...
'Units', 'normalized'); clf(figa);
uicontrol(figa, se,'text',ut,nd,pn,[0.05 0.05 0.9 0.9],...
sg, { ' ','Type fractal from a Matlab prompt. ', ' ', 'We can choose color by clicking Color menu. ',' ', ...
'We can select different Demo number to get different fractals ', ' ',...
'We can center the graph by click mouse at the point where we want it centered ', ' ',...
'We can click Zoom In/Out to view details or whole graph ', ' ',...
'We can select the levels of graphs to be combined, and the number of points for each level graph. ', ' ',...
'We can define our own graph by modify the matrix tf in the brown text window ', ' ',...
'We can define our own graph by modify the matrix tf in the brown text window ', ' ',...
' '},...
'BackgroundColor',[0.1 0.9 0.9]);
uicontrol(figa,se,'push',ut,nd,pn,[0.3 0.06 .2 .05], ...
sg,'More',ck,'fwin(41)');
uicontrol(figa,se,'push',ut,nd,pn,[0.5 0.06 .2 .05], ...
sg,'Done',ck,'close(figa)');
text(0.1, 0.9, 'Type fractal from a Matlab prompt');
text(0.1, 0.85, 'Select a color by clicking Color menu');
end
if (arg1 == 4 ),
figa=figure('MenuBar', 'none', 'NumberTitle','off',...
'Name', 'ATLAST Project: Fractal (pop-up window)',...
'Units', 'normalized'); clf(figa);
uicontrol(figa,se,'push',ut,nd,pn,[0.4 0.005 .2 .05], ...
sg,'Done',ck,'close(figa)');
plot([-0.01],[1]); hold on; plot([0]);
plot([0.16 0.15 0.15 0.16], [0.44 0.44 0.30 0.30], ['b']);
plot([0.2 0.21 0.21 0.2], [0.44 0.44 0.30 0.30], ['b']);
plot([0.3 0.29 0.29 0.3], [0.44 0.44 0.30 0.30], ['b']);
plot([0.4 0.41 0.41 0.4], [0.44 0.44 0.30 0.30], ['b']);
plot([0.44 0.43 0.43 0.44], [0.44 0.44 0.30 0.30], ['b']);
plot([0.49 0.50 0.50 0.49], [0.44 0.44 0.30 0.30], ['b']);
plot([0.60 0.59 0.59 0.60], [0.44 0.44 0.30 0.30], ['b']);
plot([0.65 0.66 0.66 0.65], [0.44 0.44 0.30 0.30], ['b']);
axis off
text(-0.1, 1.00, '1 From a Matlab prompt type: fractal');
text(-0.1, 0.95, '2 Select a color by clicking Color menu.');
text(-0.1, 0.90, '3 Select a Demo number to get different fractals.');
text(-0.1, 0.85, '4 Center the graph by clicking the mouse at the point where you want the center to be.');
text(-0.1, 0.80, '5 Click Zoom In/Out to view details or the whole graph.');
text(-0.1, 0.75, '6 Select the number of levels of graphs to be combined.');
text(-0.1, 0.70, '7 Select the number of points for each level graph.');
text(-0.1, 0.65, '8 Modify if you wish the tf matrix in the brown text widow.');
text(-0.1, 0.60, ' (Then you would generate different fractals.) ');
text(-0.1, 0.55, ' Each row of tf provides an affine mapping and the probability of using it.');
text( 0.0, 0.48, 'Say, [ t1 t2 t3 t4 s1 s2 p0 ] is a row of tf, then');
th=text( 0.1, 0.41, ' y1 t1 t2 x1 s1 ');
set(th, 'Color','blue');
th=text( 0.1, 0.37, ' = +');
set(th, 'Color','blue');
th=text( 0.1, 0.335, ' y2 t3 t4 x2 s2 ');
set(th, 'Color','blue');
text( 0.0, 0.27, 'where (x1,x2) is an old point, and (y1,y2) is a new point.');
text( 0.0, 0.22, 'Then (y1,y2) would be used to generate next point.');
text( 0.0, 0.17, 'We provide up to five such affine transformations to be used.');
text( 0.0, 0.12, 'We randomly choose one to be used, but according to the probability defined in the ');
text( 0.0, 0.07, 'last column of tf, say p0 above.');
text(-0.1, 0.00, '9 Click plot now to plot a new graph.');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -