- /
- 
        Sunflower Seeds
        on 17 Nov 2023
        
        
 
    - 17
- 67
- 0
- 2
- 741
drawframe(1);
function drawframe(f)
    phi = (sqrt(5)+1)/2;
    maxval = 1500;
    d = 2*pi/phi;
    theta = 0:d:maxval;
    r = sqrt(theta);
    [x,y] = pol2cart(theta,r);
    clf
    hgt = hgtransform;
    [v,c] = voronoin([x' y']);
    for i = 1:length(c)
        if all(c{i}~=1)
            patch(hgt,v(c{i},1),v(c{i},2),i, ...
                EdgeColor=0.6*[1 1 1], ...
                LineWidth=0.1);
        end
    end
    line(hgt,x,y, ...
        LineStyle='none',Color=0.3*[1 1 1], ...
        Marker='.',MarkerSize=3)
    k = 38;
    % This is an annular mask to cover up the edges of the sunflower
    tt = linspace(0,2*pi,100);
    h = patch(hgt,[0.95*k*cos(tt) 2*k*cos(tt)],[0.95*k*sin(tt) 2*k*sin(tt)],'white','EdgeColor','none');
    line(hgt,0.95*k*cos(tt),0.95*k*sin(tt),'Color',0.6*[1 1 1],'LineWidth',1)
    axis(k*[-1 1 -1 1])
    axis off
    axis square
    set(gca,'Units','normalized','Position',[0 0 1 1])
    colormap(flipud(summer.^0.5))
    r = interp1([0 48],[8*pi 0],f);
    R = makehgtform('zrotate', r);
    set(hgt,'Matrix',R)    
end


 

 
            
             
            