Plotting a sphere consisting of planes
2 次查看(过去 30 天)
显示 更早的评论
Hi folks,
i want to plot a sphere consisting of triangular planes. The cartesian coordinates of the planes are given by their respective corner points A, B and C which have their own 3D-coordinates A(Ax, Ay, Az), B(Bx, By, Bz) and C(Cx, Cy, Cz). The usual plot-Function does not produce reasonable results.
Does anyone has a suggestion?
2 个评论
darova
2020-4-6
Can you show some of your attempts? Do you have a picture of the result? Can you make a simple drawing or something?
回答(1 个)
darova
2020-4-6
Use patch for this problem
% create data of format
% Ax Ay Az
% Ax Ay Az
% ...
% Bx By Bz
% Bx By Bz
% ...
% Cx Cy Cz
% Cx Cy Cz
% ...
fv.vertices = reshape(A(:,5:13),[],3);
% create connection list of format
% 1 n+1 2n+1
% 2 n+2 2n+2
% 3 n+3 2n+3
% ...
n = size(A,1);
fv.faces = [1:n; (1:n)+n; (1:n)+2*n]';
fv.facecolor = 'yellow';
patch(fv)
4 个评论
darova
2020-4-20
I made a wrong script, sorry. Try this:
A1 = importdata('surfaces_cylinder.txt');
A = A1.data;
ii = [5 8 11];
patch(A(:,ii)',A(:,ii+1)',A(:,ii+2)','y')
axis vis3d
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!