%MakeBore function for burnArea Heterogeneous Grain Burn Simulator %Graham Orr %Last Revised on 12 Feb 2008 function B = makeBore(r,choice) clf; N=200; %make this larger or smaller to change the resolution of the simulation. %Note: this is the NxN matrix. Computation time increases as N^2. if (choice==1) plot(0,0,'pentagram','MarkerFaceColor',[0 0 0],'MarkerSize', 0.96*r*N) else end if (choice==2) plot(0,0,'.','MarkerFaceColor',[0 0 0],'MarkerSize', 2.95*r*N) else end if (choice==3)plot(0,0,'square','MarkerFaceColor',[0 0 0],'MarkerSize', r*N) else end axis([-N/2 N/2 -N/2 N/2]); pause(.1); x=getframe(); %this isn't super efficient but it uses a screen shot to make the array [h w q]=size(x.cdata); A=x.cdata(:,:,1); i=round(w/2-N/2):round(w/2+N/2); j=round(h/2-N/2):round(h/2+N/2); B=ones(N+1,N+1)-double(A(j,i)/255); %Yay,an array of 1s and 0s!