drawquadblocks.m

来自「quadtree implementation in matlab」· M 代码 · 共 23 行

M
23
字号
% % draw square quad blocks of quadtree in eight basic colors.
% % S: Sparse matrix that holds quadtree information
function drawquadblocks(S)

mycol = strvcat('r','y','g','c','b','m','k','w');
[i,j,v]=find(S); %i,j are indices, v is value (i.e. block size) at (i,j)
figure, hold on
for k=1:length(v)
    M = mod(k-1,length(mycol))+1;
    fillrect_ulwh([j(k),i(k)],v(k),v(k),mycol(M));
end
axis tight 

% % -------------------------------------------------------------------------
% % This program or any other program(s) supplied with it does not provide any
% % warranty direct or implied. This program is free to use/share for
% % non-commercial purpose only, for any other usage contact with author.
% % Kindly reference author.
% % Thanking you.
% % @ Copyright M Khan
% % Email: mak2000sw@yahoo.com
% %        mak2000@GameBox.net 
% % http://www.geocities.com/mak2000sw

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?