2番目の質問(三角形のサーフェス)に関しては、次のコードを使用します。
%% Wire plot
% The idea is to plot all triangles as one line. But to make part of the
% line connecting two triangles invisible, add NaN after each 3 points of
% triangle.
NTri = size(N,1);
X = reshape(pointsArray(N.',1), 3, NTri); X = reshape([X; nan(1,NTri)], 4*NTri, 1);
Y = reshape(pointsArray(N.',2), 3, NTri); Y = reshape([Y; nan(1,NTri)], 4*NTri, 1);
Z = reshape(pointsArray(N.',3), 3, NTri); Z = reshape([Z; nan(1,NTri)], 4*NTri, 1);
figure;
plot3(X,Y,Z,'-k.');
axis equal
%% Surface plot
% patch also can plot all triangles at once. I use the following code to
% plot triangulated objects consisting of more than 300000 triangles and it
% is very fast.
px = [pointsArray(N(:,1),1) pointsArray(N(:,2),1) pointsArray(N(:,3),1)].';
py = [pointsArray(N(:,1),2) pointsArray(N(:,2),2) pointsArray(N(:,3),2)].';
pz = [pointsArray(N(:,1),3) pointsArray(N(:,2),3) pointsArray(N(:,3),3)].';
figure
patch(px,py,pz, 'g');
axis equal
それが誰かに役立つことを願っています。
//オレグ