- /
- 
        Bucky Ball
        on 12 Nov 2023
        
        
 
    - 13
- 52
- 0
- 0
- 530
drawframe(1);
 Write your drawframe function below
function drawframe(f)
    % Truncated icosahedron
    B = bucky;
    P = plot(graph(B), Layout = 'force3');
    V = [P.XData.', P.YData.', P.ZData.'];
    V = V/max(max(abs(V)));
    cla
    C = allcycles(graph(B), maxCycleLength = 6);
    L = cellfun(@length, C);
    F = NaN(height(C), max(L));
    for k = 1:height(C)
        F(k,1:L(k)) = C{k};
    end
    colors = [0 0 0.5; 1 1 1];
    faceColor = colors((L == max(L))+1, :);
    view(3)
    axis square
    if nargin > 0
        t = (f-1)*180/24;
        R = [cosd(t) sind(t) 0; -sind(t) cosd(t) 0; 0 0 1];
        V = V*R;
    end
    patch( ...
        Faces = F, ...
        Vertices = V, ...
        EdgeColor = colors(1,:), ...
        FaceVertexCData = faceColor, ...
        FaceColor = 'flat')
end


 

 
           