[p,f,t] = read_tetgenmesh('mesh/unitcube.1');
%plot all points
subplot(2,2,1)
plot3(p(1,:),p(2,:),p(3,:),'o');
axis equal
title('POINTS')
%plot edges
%{
subfig(2,2,2)
plot3(0,0,0); hold on;
for i=1:size(e,2)
point1 = p(1:3,e(1,i));
point2 = p(1:3,e(2,i));
plot3(point1(1),point1(2),point1(3),'o','linewidth',4)
plot3(point2(1),point2(2),point2(3),'o','linewidth',4)
end
title('EDGES')
%}
%plot a few faces
subplot(2,2,3)
plot3([0 0 0 1 1 1 0 1],[0 1 0 0 1 1 1 0],[0 0 1 0 1 0 1 1],'*'); hold on;
for i=1:2
%for i=1:size(f,2)
points = p(1:3,f(1:3,i));
fill3(points(1,:),points(2,:),points(3,:),'r')
end
axis equal
title('FACES')
%plot a few tetras
subplot(2,2,4)
plot3([0 0 0 1 1 1 0 1],[0 1 0 0 1 1 1 0],[0 0 1 0 1 0 1 1],'*'); hold on;
for i=1:2
%for i=1:size(t,2)
points = p(1:3,t(1:4,i));
points_ = points(:,[1 2 3]);
fill3(points_(1,:),points_(2,:),points_(3,:),'r')
points_ = points(:,[2 3 4]);
fill3(points_(1,:),points_(2,:),points_(3,:),'r')
points_ = points(:,[3 4 1]);
fill3(points_(1,:),points_(2,:),points_(3,:),'r')
points_ = points(:,[4 1 2]);
fill3(points_(1,:),points_(2,:),points_(3,:),'r')
end
axis equal
title('TETRAS')