- /
-
Spring
on 27 Oct 2021
- 1
- 4
- 0
- 0
- 269
Strg='-F+F-F-FF-FF-F-FFF-FF-FF-F-FF-F-';
Str1=strrep(Strg,'F',Strg)
alpha=0
oldx=0
oldy=0
for i=1:length(Str1)
comd=Str1(i);
switch(comd)
case 'F'
newx=oldx+cos(deg2rad(alpha));
newy=oldy+sin(deg2rad(alpha));
line([oldx newx],[oldy newy]);
oldx=newx;
oldy=newy;
case '-'
alpha=alpha+30;
end
end