我已经编写了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'是绘图功能,它实际上并不生成网格物体。 –