- /
-
Raking the oak leaves
on 29 Oct 2021
- 9
- 131
- 0
- 0
- 279
% Remix of Eric Ludlam's Pile of Oak Leaves, adding a rake
% Quite a few modifications needed to create character space
% but the biggest change is the size and position of the axes.
t=0:.01:3; % saved 2 chars (pi->3 and 0.01->.01)
% r=@rand; % No longer helpful after removing 1 rand
c=@(f)cos(f*t);
s=@(f)sin(f*t);
hold
% Moved out of loop
% in y=__, removed -.5 which shifts leaves rightward
% from y=+/.5 to y=0:1 saving 3 chars.
x=.01*c(1).^9.*c(5).^10+s(2)/4.*(1-s(10).^2/2).*(1-(c(1).*c(3)).^8);
y=s(1).*(1-s(10).^2/5.*(.5+s(2).^2));
% The i value within the loop doesn't matter, only
% the number of iterations matters. i=1:300 replaced
% with t which has 301 values saving 4 chars.
for i=t
% Saved 7 chars here by removing linew=1 and replaced
% r()*360 with i*120 which has the same effect. i contains
% the range [0,3] so muliplying by 120 converts to [0,360]..
rotate(fill(5*rand+x,5*rand+y,rand),[0
0
1],i*120);
end
% Since the random values are approximately 0:1 for
% both x and y axes, axis equal has a minor effect
% on most runs so it's removed saving 6 chars.
% axis equal off
% camva(4) % or just use axis off
axis off
% This would be nice (or perhaps camva(4) instead)
% set(gca,Pos=[0 %saved 19 chars here;
% 0
% 1
% 1])
colormap autumn
% Now we have 55 chars for a (very low quality) rake.
% Maybe someone with better skillz can add a handle!
g=@(f)[0;3]*f(0:.2:1);
plot(g(@cos),g(@sin),'k',LineW=5)