MATLAB Answers

0

How do I align the vertices and the adjacency graph of a Buckyball?

Matlab User さんによって質問されました 2019 年 11 月 16 日 7:48
最新アクティビティ darova
さんによって 回答されました 2019 年 11 月 16 日 14:04
Inspired by hypercubes-and-graphs, I would like to visualize a wireframe model of a Buckyball. Using the following code, I am almost there but I need some advice on how to create the apparent rotational misalignment which exists between the graph and the 3D plot.
How do I align the two "plots": one produced with plot3 (the vertices); and the other with plot (the adjacency graph)?
[B, v] = bucky;
G = graph(B);
A = 4; % A scaling factor
plot3(A*v(:,1), A*v(:,2), A*v(:,3), 'o'), hold on
plot(G,'layout','force3')
axis square off vis3d
set(gca,'clipping','off'), hold off

  0 件のコメント

サインイン to comment.

製品


リリース

R2018b

1 件の回答

darova
Answer by darova
on 16 Nov 2019 at 14:04

Here is a way
ind = full(B); % convert to ordinary matrix
[rr,cc] = find(ind); % find non-zero elements
ix = [rr cc]'; % set-up connections
x = A*v(:,1);
y = A*v(:,2);
z = A*v(:,3);
plot3(x(ix),y(ix),z(ix));

  0 件のコメント

サインイン to comment.



Translated by