- /
-
Dragon Curve Generations
on 29 Nov 2023
- 9
- 8
- 0
- 0
- 178
drawframe(1);
Write your drawframe function below
function drawframe(f)
k=lines(48);
persistent c p;
if f==1
c=[0;0];
p=[1;0];
end
if f<24
q=[0 -1; 1 0]*(p-c)+c;
p=[p fliplr(q)];
c=q(:,1);
elseif f>26
p=p(:,1:end/2);
end
plot(p(1,:),p(2,:),'color',k(f,:)); axis equal off;
end