• Remix
  • Share
  • New Entry

on 10 Oct 2021
  • 4
  • 32
  • 0
  • 0
  • 278
% A pine tree in snow weather
% Based on the Barnsley fern fractal algorithm
% João Zerba https://www.mathworks.com/matlabcentral/fileexchange/100456-pine-tree-with-snow-fern-fractal-mod
N=10e5;
xy=[0;0];
f=zeros(N,2);
P=rand(N,1);
b = [0;1.6];
for i=2:N
if P(i)<0.01
xy=[0 0; 0 0.16]*xy;
elseif P(i)<0.86
xy=[0.75 0.00;-0.04 0.85]*xy+b;
elseif P(i)<0.93
xy=[0.2 -0.26;0.23 0.22]*xy+b;
else
xy=[-0.15 0.28;0.26 0.24]*xy+b*2.75;
end
f(i,1)=xy(1);
f(i,2)=xy(2);
end
scatter(f(:,1),f(:,2),0.1,'.');
Image
Remix Tree