%FRACCTL is a subroutine of the driving program FRACTORY. It %generates the control panel user iterface which allows the %user to manipulate IFS parameters numerically. %Setup intial data K=1; n=1; curdat=[0 1 0 0 1 0 1 1 0 1 8]'; ifsdat=curdat(1:6); oldn=0; fcnon=[1]; viewon=0; ldsvon=0; %Setup control panel "CPAN" (current setup for editing) Cpan=figure; set(Cpan,'Position',[10 100 365 560]); %Fractal activation frame FAframe = uicontrol(Cpan,... 'Style','frame',... 'Position',[170 95 185 110]); FApos=get(FAframe,'Position'); FApos(3:4)=[0 0]; %Hold function check box hldbx=0; HFbox = uicontrol(Cpan,... 'Style','checkbox',... 'Position',FApos+[10 34 165 20],... 'String','Hold Function Boxes',... 'CallBack',['hldbx=0;',... 'if get(HFbox,''value'')==1,',... 'hldbx=1;',... 'end']); %Interuptable check box intrp=0; INbox = uicontrol(Cpan,... 'Style','checkbox',... 'Position',FApos+[10 8 165 20],... 'String','Drawing Interuptable',... 'CallBack',['intrp=0;',... 'if get(INbox,''value'')==1,',... 'intrp=1;',... 'end']); %Draw fractal button DrFbutt = uicontrol(Cpan,... 'Style','push',... 'Position',FApos+[10 62 95 38],... 'String','Draw Fractal',... 'Interruptible','yes',... 'CallBack','makefrac'); %Number of iterations editable text NIedtx = uicontrol(Cpan,... 'Style','edit',... 'Position',FApos+[110 62 65 20],... 'String','10000'); %Number of iterations static text NIsttx = uicontrol(Cpan,... 'Style','text',... 'Position',FApos+[110 82 65 18],... 'String','Iterations'); %Help button HEbutt = uicontrol(Cpan,... 'Style','push',... 'Position',[10 10 70 35],... 'String','Help',... 'CallBack',['if viewon~=-1,',... 'if viewon==1,',... 'for nn=1:12,',... 'delete(viewbox(nn)),',... 'end,',... 'end,',... 'viewon=-1;',... 'ctlmode=''off'';',... 'setwho=1;',... 'setctl,',... 'frachelp,',... 'end']); %Ax+b button VWbutt = uicontrol(Cpan,... 'Style','push',... 'Position',[90 10 70 35],... 'String','Ax+b',... 'CallBack',['if viewon~=1,',... 'if viewon==-1,',... 'for nn=1:16,',... 'delete(helpbox(nn)),',... 'end,',... 'end,',... 'viewon=1;',... 'ctlmode=''off'';',... 'setwho=1;',... 'setctl,',... 'ViewAb,'... 'curdat(11)=-3;','updatecd,',... 'end']); %Load button LObutt = uicontrol(Cpan,... 'Style','push',... 'Position',[180 52 75 33],... 'String','Load',... 'CallBack',['loadon=1;',... 'fracldsv']); %Save button SAbutt = uicontrol(Cpan,... 'Style','push',... 'Position',[265 52 75 33],... 'String','Save',... 'CallBack',['loadon=0;',... 'fracldsv']); %Clear all functions button CAbutt = uicontrol(Cpan,... 'Style','push',... 'Position',[180 10 75 33],... 'String','Clear All',... 'CallBack',['for nn=1:K,',... 'delete(fcns(nn)),',... 'end,',... 'clear fcns,',... 'fcnon=[1];',... 'n=1;','K=1;','oldn=0;',... 'curdat(11)=-1;','updatecd']); %Quit button QUbutt = uicontrol(Cpan,... 'Style','push',... 'Position',[265 10 75 33],... 'String','Quit',... 'CallBack',['delete(Cpan),','delete(Gscr)']); %Square transformation frame STframe = uicontrol(Cpan,... 'Style','frame',... 'Position',[10 55 150 495]); STpos=get(STframe,'Position'); STpos(3:4)=[0 0]; STpos=STpos+[0 5 0 0]; %Flip | button FL1butt = uicontrol(Cpan,... 'Style','push',... 'Position',STpos+[10 5 25 20],... 'String','!',... 'CallBack',['curdat(11)=6;','updatecd']); %Flip - button FL2butt = uicontrol(Cpan,... 'Style','push',... 'Position',STpos+[45 5 25 20],... 'String','-',... 'CallBack',['curdat(11)=7;','updatecd']); %Flip / button FL3butt = uicontrol(Cpan,... 'Style','push',... 'Position',STpos+[80 5 25 20],... 'String','/',... 'CallBack',['curdat(11)=6.5;','updatecd']); %Flip \ button FL4butt = uicontrol(Cpan,... 'Style','push',... 'Position',STpos+[115 5 25 20],... 'String','\',... 'CallBack',['curdat(11)=7.5;','updatecd']); %Flip static text FLsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[5 25 140 20],... 'String','Flip'); ht2=355; %Shift y lable static text Systtx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[10 ht2 10 20],... 'String','y'); %Shift y slider Sysldr = uicontrol(Cpan,... 'Style','slider',... 'Position',STpos+[20 ht2 120 20],... 'CallBack',[... 'newv=[curdat(3) ; get(Sysldr,''Value'')];'... 'curdat(11)=4;','updatecd']); %Shift x lable static text Sxsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[10 ht2+25 10 20],... 'String','x'); %Shift x slider Sxsldr = uicontrol(Cpan,... 'Style','slider',... 'Position',STpos+[20 ht2+25 120 20],... 'CallBack',[... 'newv=[get(Sxsldr,''Value'') ; curdat(4)];'... 'curdat(11)=4;','updatecd']); %Shift xy labels static text SLsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[20 ht2+45 120 15],... 'String','0 . . . . . . . . 1'); %Shift xy title static text STsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[5 ht2+60 140 20],... 'String','Shift ( , )'); %Shift x editable text Sxedtx = uicontrol(Cpan,... 'Style','edit',... 'Position',STpos+[45 ht2+60 43 20],... 'String','0',... 'CallBack',[... 'newv=[eval(get(Sxedtx,''String'')) ; curdat(4)];',... 'curdat(11)=4;','updatecd']); %Shift y editable text Syedtx = uicontrol(Cpan,... 'Style','edit',... 'Position',STpos+[92 ht2+60 43 20],... 'String','0',... 'CallBack',[... 'newv=[curdat(3) ; eval(get(Syedtx,''String''))];',... 'curdat(11)=4;','updatecd']); ht1=278; %Rotate slider RTsldr = uicontrol(Cpan,... 'Style','slider',... 'Position',STpos+[10 ht1 130 20],... 'Min',0,'Max',360,'Value',0,... 'CallBack',[... 'theta=round(get(RTsldr,''Value'')/3)*3;',... 'curdat(11)=0;','updatecd']); %Rotate lables static text RLsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[10 ht1+20 130 15],... 'String',' 0 . . . . . . . 360'); %Rotate title static text RTsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[20 ht1+35 70 20],... 'String','Rotate'); %Rotate editable text RTedtx = uicontrol(Cpan,... 'Style','edit',... 'Position',STpos+[80 ht1+35 35 20],... 'String','0',... 'CallBack',['theta=eval(get(RTedtx,''String''));',... 'curdat(11)=0;','updatecd']); ht4=207; %Opening slider OPsldr = uicontrol(Cpan,... 'Style','slider',... 'Position',STpos+[10 ht4 130 20],... 'Min',0,'Max',360,'Value',90,... 'CallBack',[... 'theta=round(get(OPsldr,''Value'')/3)*3;',... 'curdat(11)=9;','updatecd']); %Opening lables static text OPsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[10 ht4+20 130 15],... 'String',' 0 . . . . . . . 360'); %Opening title static text OPsttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[15 ht4+35 80 20],... 'String','Angle XYZ'); %Opening editable text OPedtx = uicontrol(Cpan,... 'Style','edit',... 'Position',STpos+[95 ht4+35 35 20],... 'String','90',... 'CallBack',['theta=eval(get(OPedtx,''String''));',... 'curdat(11)=9;','updatecd']); ht3=128; %Scale slider SCsldr = uicontrol(Cpan,... 'Style','slider',... 'Position',STpos+[10 ht3 130 20],... 'Min',0,'Max',1,'Value',1,... 'CallBack',['scale=get(SCsldr,''Value'');',... 'curdat(11)=5;','updatecd']); %Scale lables static text SC1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[10 ht3+20 130 15],... 'String',' 0 . . . . . . . 1'); %Scale static text SC2sttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[20 ht3+35 70 20],... 'String','Scale'); %Scale editable text SCedtx = uicontrol(Cpan,... 'Style','edit',... 'Position',STpos+[80 ht3+35 43 20],... 'String','1',... 'CallBack',['scale=eval(get(SCedtx,''String''));',... 'curdat(11)=5;','updatecd']); ht5=57; %Length XY/YZ slider LEsldr = uicontrol(Cpan,... 'Style','slider',... 'Position',STpos+[10 ht5 130 20],... 'Min',0,'Max',1.4,'Value',1,... 'CallBack',['length=get(LEsldr,''Value'');',... 'curdat(11)=10.5-0.5*XY0YZ1;','updatecd']); %Length XY/YZ lables static text LE1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[10 ht5+20 130 15],... 'String',' 0 . . . . . . . 1.4'); %Length XY/YZ static text LE2sttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[10 ht5+35 50 20],... 'String','Length'); XY0YZ1=1; %Length XY/YZ toggle button LEbutt = uicontrol(Cpan,... 'Style','push',... 'Position',STpos+[61 ht5+35 22 20],... 'String','YZ',... 'CallBack',['XY0YZ1=mod(XY0YZ1+1,2);',... 'if XY0YZ1==0,',... 'set(LEbutt,''String'',''XY'');',... 'else,',... 'set(LEbutt,''String'',''YZ'');',... 'end,',... 'curdat(11)=-3;','updatecd']); %Length XY/YZ editable text LEedtx = uicontrol(Cpan,... 'Style','edit',... 'Position',STpos+[90 ht5+35 43 20],... 'String','1',... 'CallBack',['length=eval(get(LEedtx,''String''));',... 'curdat(11)=10.5-0.5*XY0YZ1;','updatecd']); %Square transformation title static text SQ1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[5 465 140 20],... 'String','SQUARE'); SQ2sttx = uicontrol(Cpan,... 'Style','text',... 'Position',STpos+[5 450 140 20],... 'String','TRANSFORMATION'); %Corner Coordinates frame CCframe = uicontrol(Cpan,... 'Style','frame',... 'Position',[175 215 170 135]); CCpos=get(CCframe,'Position'); CCpos(3:4)=[0 0]; %W static text W1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',CCpos+[5 6 150 20],... 'String','W(1,1): ( , )'); W2sttx = uicontrol(Cpan,... 'Style','text',... 'Position',CCpos+[62 6 40 20],... 'String','1'); W3sttx = uicontrol(Cpan,... 'Style','text',... 'Position',CCpos+[108 6 40 20],... 'String','1'); %Z static text Z1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',CCpos+[5 30 160 20],... 'String','Z(1,0): ( , )'); Z2sttx = uicontrol(Cpan,... 'Style','edit',... 'Position',CCpos+[59 30 43 20],... 'String','1',... 'Callback',[... 'newv=[eval(get(Z2sttx,''String'')) curdat(6)];',... 'curdat(11)=3;','updatecd']); Z3sttx = uicontrol(Cpan,... 'Style','edit',... 'Position',CCpos+[111 30 43 20],... 'String','0',... 'Callback',[... 'newv=[curdat(5) eval(get(Z3sttx,''String''))];',... 'curdat(11)=3;','updatecd']); %Y static text Y1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',CCpos+[5 55 160 20],... 'String','Y(0,0): ( , )'); Y2sttx = uicontrol(Cpan,... 'Style','edit',... 'Position',CCpos+[59 55 43 20],... 'String','0',... 'Callback',[... 'newv=[eval(get(Y2sttx,''String'')) curdat(4)];',... 'curdat(11)=2;','updatecd']); Y3sttx = uicontrol(Cpan,... 'Style','edit',... 'Position',CCpos+[111 55 43 20],... 'String','0',... 'Callback',[... 'newv=[curdat(3) eval(get(Y3sttx,''String''))];',... 'curdat(11)=2;','updatecd']); %X static text X1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',CCpos+[5 80 160 20],... 'String','X(0,1): ( , )'); X2sttx = uicontrol(Cpan,... 'Style','edit',... 'Position',CCpos+[59 80 43 20],... 'String','0',... 'Callback',[... 'newv=[eval(get(X2sttx,''String'')) curdat(2)];',... 'curdat(11)=1;','updatecd']); X3sttx = uicontrol(Cpan,... 'Style','edit',... 'Position',CCpos+[112 80 43 20],... 'String','1',... 'Callback',[... 'newv=[curdat(1) eval(get(X3sttx,''String''))];',... 'curdat(11)=1;','updatecd']); %Corner coordinates title static text CCsttx = uicontrol(Cpan,... 'Style','text',... 'Position',CCpos+[5 110 155 20],... 'String','CORNER CO-ORDS'); %Function selection frame FSframe = uicontrol(Cpan,... 'Style','frame',... 'Position',[175 360 170 190]); FSpos=get(FSframe,'Position'); FSpos(3:4)=[0 0]; %Delete function button DeFbutt = uicontrol(Cpan,... 'Style','push',... 'Position',FSpos+[45 10 80 30],... 'String','Delete',... 'CallBack',['delete(fcns(n)),',... 'fcns=[fcns(:,1:n-1) fcns(:,n+1:K)];',... 'fcnon=[fcnon(:,1:n-1) fcnon(:,n+1:K)];',... 'K=K-1;','n=n-(n>K);','oldn=0;',... 'if K==0,',... 'K=1;','n=1;','curdat(11)=-1;',... 'else,',... 'curdat(11)=8;',... 'end,',... 'updatecd']); %New function button NFbutt = uicontrol(Cpan,... 'Style','push',... 'Position',FSpos+[10 45 70 30],... 'String','New',... 'CallBack',['K=K+1;','oldn=n;','n=K;',... 'curdat(11)=-1;','updatecd']); %Copy function button CFbutt = uicontrol(Cpan,... 'Style','push',... 'Position',FSpos+[90 45 70 30],... 'String','Copy',... 'CallBack',['K=K+1;','oldn=n;','n=K;',... 'fcnon(K)=1;',... 'curdat(11)=-2;','updatecd']); %Function on check box FOchbx = uicontrol(Cpan,... 'Style','checkbox',... 'Position',FSpos+[20 90 130 20],... 'String','Function On',... 'Value',fcnon(n),... 'CallBack',['if fcnon(n)==0.5,',... 'set(FOchbx,''Value'',0),',... 'else,',... 'fcnon(n)=1;',... 'if get(FOchbx,''Value'')==0,',... 'fcnon(n)=0;',... 'end,'... 'end']); %Function selection slider FSsldr = uicontrol(Cpan,... 'Style','slider',... 'Position',FSpos+[10 120 150 20],... 'Min',1,'Max',K,'Value',1,... 'CallBack',['oldn=n;',... 'n=round(get(FSsldr,''Value''));',... 'if n==oldn,',... 'n=n+sign(get(FSsldr,''Value'')-n);',... 'end,'... 'curdat(11)=8;','updatecd']); %Function selection labels static text FS1sttx = uicontrol(Cpan,... 'Style','text',... 'Position',FSpos+[5 140 160 20],... 'String',' 1 . . . . . . . . . .'); FS2sttx = uicontrol(Cpan,... 'Style','text',... 'Position',FSpos+[130 140 20 20],... 'String','1'); %Function selection headings static text FS3sttx = uicontrol(Cpan,... 'Style','text',... 'Position',FSpos+[25 160 140 20],... 'String','Function # '); FS4sttx = uicontrol(Cpan,... 'Style','text',... 'Position',FSpos+[115 160 20 20],... 'String','1');