3D hexagonal mesh grid
4 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Matt J
2023 年 10 月 17 日
編集済み: Matt J
2023 年 10 月 17 日
V=nsidedpoly(6).Vertices;
[X,Z]=ndgrid(V(:,1),0:3);
[Y,~]=ndgrid(V(:,2),0:3);
scatter3(X(:),Y(:),Z(:)); view(-60,70)
xlabel X; ylabel Y; zlabel Z
7 件のコメント
Matt J
2023 年 10 月 18 日
Now, I want to show it in a 3D space with various z values (z is constant for each layer) using this code:
I don't know what you think this changes about my answer. Isn't this what you want?
m = 6;
n = 7;
[x,y] = meshgrid(0:m, 0:n);
X = (3*x - mod(x+y,2)) / 2;
X=X+0.5;
X=X(4:8,1:4);
Y = (sqrt(3)/2)*y;
Y=Y(4:8,1:4);
Y=Y-Y(1,1);
V=[X(:),Y(:)];
[X,Z]=ndgrid(V(:,1),0:3);
[Y,~]=ndgrid(V(:,2),0:3);
scatter3(X(:),Y(:),Z(:)); view(-70,83)
xlabel X; ylabel Y; zlabel Z
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!