- /
 - 
        
Colorful Lattice (remix)
 
        on 9 Nov 2023
        
        
 
    - 9
 - 41
 - 0
 - 2
 - 452
 
drawframe(1);
Write your drawframe function below
function drawframe(f)
    H = ceil(f/4); % Decomposition parameter
    M = 3;         % Number of dimensions
    I = M * eye(M);
    W = zeros(1,M);
    edgeW = W;
    for i = 1 : H
        edgeW = repmat(edgeW,M,1) + repelem(I,height(edgeW),1);
        edgeW = unique(edgeW,'rows');
        edgeW(all(edgeW,2),:) = [];
        W = [W+1;edgeW];
    end
    W = W / (M*H);
    color = turbo(height(W)); 
    cnt = mean(W); 
    dist = sqrt((W(:,1)-cnt(1)).^2 + (W(:,2)-cnt(2)).^2 + (W(:,3)-cnt(3)).^2);
    szNorm = normalize(dist,'range')*.8+.2; 
    sz = szNorm*80+20;
    scatter3(W(:,1),W(:,2),W(:,3),sz,color,'filled');
    view(135,30);
    box on
    axis off tight
    %--------------------------------- Reference ----------------------------------
    % T. Takagi, K. Takadama, and H. Sato, Incremental lattice design of weight 
    % vector set, Proceedings of the Genetic and Evolutionary Computation 
    % Conference Companion, 2020, 1486-1494.
    %------------------------------------------------------------------------------
end
Animation
           

