• Remix
  • Share
  • New Entry

on 18 Oct 2021
  • 7
  • 20
  • 0
  • 0
  • 261
col = 'kybr';
for i=1:4
DragonCurve(i,col(i));
hold on;
end
axis(512/sqrt(2)*[-1 1 -1 1]);
function DragonCurve(n,col)
c=[0;0];
z=(1i)^n;
p=[real(z);imag(z)];
R=[0 -1; 1 0];
for i=1:25
q=R*(p-c)+c;
p=[p c fliplr(q(:,2:end))];
c=q(:,1);
end
plot(p(1,:),p(2,:),'color',col);
axis equal off;
end
Image
Remix Tree