%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (GS) This code generates random tree pictures %
% I copied this from the picture Jourdan had on his computer %
% https://pannaya.com/falseprophet/ %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;
figure(‘Color’,[0.8 1 0.75],’units’,’normalized’,’outerposition’,[0 0 1 1]);
axis off
grid off
hold on
set(gcf,’Visible’,’off’);
%(GS) The number of trees in the image can be changed here:
%(GS) If you make the number too big it takes a while to run.
NumTrees=100;
for loop1=1:NumTrees
clear xy xs ys admat
shiftx=rand10; shifty=rand10;
roots=ceil(rand20); branches=[0 1]; for loop=1:roots adds=min(ceil(randloop),loop);
branches=[branches loopceil(rand(1,adds))]; end for loop=1:length(branches) admat(loop,loop)=1; admat(loop,find(branches==loop))=1; admat(find(branches==loop),loop)=1; end xs=(treelayout(branches)-0.5)ceil(rand5+1)+0.5+shiftx+0.2rand(1,length(branches));
for loop=0:max(branches)
hits=find(branches==loop);
ys(hits)=log(loop)+shifty+0.5rand(1,length(hits)); end tx=xs(1); ty=ys(end); xy=[xs;ys]’; hold on for loop3=1:length(branches) joins=find(admat(loop3,:)==1); colour=[0.6 0.5 0.3]+rand(1,3)0.1;
for loop2=joins
x=[xs(loop3) xs(loop2)];
y=[ys(loop3) ys(loop2)];
if loop2>6;
colour=[0 1 0]rand0.2+[0 0.8 0];
end
plot(x,y,’Color’,colour,’LineWidth’,10*exp(-loop2/4));
end
end %%%%%%%%%%%%%%%%%%%%%%%%%add some leaves%%%%%%%%%%%%%%%%%%% colour=[0 0 0]; for loop=1:ceil(rand*15)+2; colour=colour+randn(1,3)*0.1; colour(find(colour<0))=0;colour(find(colour>1))=1; plot(tx+rand*0.3,ty+rand*0.3,'.','Color',colour,'MarkerSize',5) end %%%%%%%%%%%%%%%%%%%%%%%%%%add some fruit%%%%%%%%%%%%%%%%%%%%% if rand>0.7 colour=[1 0 0]; for loop=1:ceil(rand*15)+2; colour=colour+randn(1,3)*0.1; colour(find(colour<0))=0;colour(find(colour>1))=1; plot(tx+rand*0.3,ty+rand*0.3,'.','Color',colour,'MarkerSize',ceil(rand*25)) end end
end
set(gcf,’Visible’,’on’);
I=getframe(gcf);
imwrite(I.cdata, ‘Tree.tiff’,’Compression’,’none’);