I would like to know how to store faces and vertices in order to generate an stlwrite file for the entire structure
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
code: This code will generarte one stl file with one vornoi polygon since I am not storing all the faces and vertices of the whole polygon
for k = 1:length(Cel)
if ~isempty(Cel{k})
col=rand(1,3);
Vk = Ver(Cel{k},:); Fk = convhull(Vk);
if exist('mergeCoplanarFaces.m','file')==2
[Vk, Fk] = mergeCoplanarFaces(Vk, Fk);
for i=1:length(Fk)
patch('Vertices',Vk,'Faces',Fk{i},'FaceColor',col,'FaceAlpha',0.3)
end
else
trisurf(Fk,Vk(:,1),Vk(:,2),Vk(:,3),'FaceColor',col, ...
'FaceAlpha', 1,'EdgeAlpha',1,'EdgeColor','k');
end
end
end
grid on
xlabel('X');ylabel('Y');zlabel('Z');
stlwrite('mytriangulation.stl',struct('faces',Fk,'vertices',Vk));
2 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Voronoi Diagram finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!