フィルターのクリア

How did they make this Hexagonal Matrix?...

3 ビュー (過去 30 日間)
Kalamaya
Kalamaya 2012 年 12 月 3 日
Hi, Im trying to figure out how the following figure was generated using MATLAB, in this video.
Specifically, how did they make the hexagonal cell matrix that is being shown here? I am really not sure where to even begin learning about this technique... Thanks!

回答 (2 件)

Sean de Wolski
Sean de Wolski 2012 年 12 月 3 日
編集済み: Sean de Wolski 2012 年 12 月 3 日
Probably by making lots of little hexagonal patches.
doc patch
For more information.
More because Matt J motivated me to try it, lopsided non-aligned patches!
x1 = [0.5 1 1.5 1 0.5 0];
y1 = [0 0 0.5 1 1 0.5];
n = 10;
xd = bsxfun(@plus,x1,(1:1.5:n*1.5)');
yd = bsxfun(@plus,y1,(1:1.5:n*1.5)');
for ii = 1:n
for jj = 1:n
patch('XData',xd(ii,:),'YData',yd(jj,:),'FaceColor',rand(1,3))
end
end

Matt J
Matt J 2012 年 12 月 3 日
編集済み: Matt J 2012 年 12 月 3 日
Building upon Sean's remark, it might look something like this
[x,y]=ndgrid(1:42,1:42);
idx=logical(mod(y,2));
x(idx)=x(idx)+.5;
[v,c] = voronoin([x(:),y(:)]);
clf
for i=1:length(c)
patch('XData',v(c{i},1),'YData',v(c{i},2),...
'EdgeColor','b','FaceColor',[255 182 193]/255)
end

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by