clear all
load data
% Start at 1350 as the data seems to contain a lot of unnecessary triangles
figure
patch('Faces',faces(1350:end,:),'Vertices',vertices,'FaceColor','r','EdgeColor','k','FaceAlpha',0.7);
% Plot the last "triangle" using mpt
P = Polyhedron('V', vertices(faces(end,:),:), 'R', normals(end,:));
plot(P)
% Plot the last triangle using patch
figure
hold on
patch('Faces',faces(end,:),'Vertices',vertices,'FaceColor','r','EdgeColor','k','FaceAlpha',0.7);
start = [sum(vertices(faces(end,:),1)) sum(vertices(faces(end,:),2)) sum(vertices(faces(end,:),3))]/3;
line([start(1) start(1)+normals(end,1)],[start(2) start(2)+normals(end,2)], [start(3) start(3)+normals(end,3)])