我已經編寫了MATLAB代碼(如下所示),它創建了一個邊,然後構建了從該邊延伸的網格。我可以將3D模型看作網格物體,但無法將此模型導出爲3d對象,例如stl或obj。如何將MATLAB中的網格導出爲stl或obj?
我讀轉換爲STL,它使用像這樣的例子很多:
% Extract the surface mesh
M=isosurface(x,y,z,F,0);
tr=TriRep(M.faces,M.vertices);
figure('color','w'), h=trimesh(tr); axis equal
% Write to .stl
stlwrite('PillBoxExample.stl',tr.Triangulation,tr.X)
但在我的代碼,我用剛剛網:
figure;
M= surface(-finalLSF);
hold on; contour(phi, [0,0], 'r','LineWidth',2);
我試了很多時間把它轉換,但我仍然有錯誤。
代碼:
Img = imread('MK2.jpg');
Img=double(Img(:,:,1));
%
% ... other code ...
%
figure;
M= mesh(-finalLSF);
hold on; contour(phi, [0,0], 'r','LineWidth',2);
str=['Final level set function, ', num2str(iter_outer*iter_inner+iter_refine), ' iterations'];
title(str);
axis on;
我不知道你是否可以,如果你應該。 'mesh'是繪圖功能,它實際上並不生成網格物體。 –