I have a .fig file and can I export it to the .obj file?
14 次查看(过去 30 天)
显示 更早的评论
Hello I have a code
x = gallery('uniformdata',30,1,1);
y = gallery('uniformdata',30,1,10);
plot(x,y,'.')
axis([-0.2 1.2 -0.2 1.2])
axis equal
k = boundary(x,y);
hold on
plot(x(k),y(k))
hold off
k0 = boundary(x,y,0);
k1 = boundary(x,y,1);
hold on
plot(x(k0),y(k0))
plot(x(k1),y(k1))
hold off
legend('Original points','Shrink factor: 0.5 (default)',...
'Shrink factor: 0','Shrink factor: 1')
P = gallery('uniformdata',30,3,5);
plot3(P(:,1),P(:,2),P(:,3),'.','MarkerSize',10)
grid on
k = boundary(P);
hold on
trisurf(k,P(:,1),P(:,2),P(:,3),'Facecolor','red','FaceAlpha',0.1)
hold off
[r,g,b] = meshgrid(linspace(0,1,50));
rgb = [r(:), g(:), b(:)];
lab = rgb2lab(rgb);
a = lab(:,2);
b = lab(:,3);
L = lab(:,1);
k = boundary(a,b,L);
trisurf(k,a,b,L,'FaceColor','interp',...
'FaceVertexCData',rgb,'EdgeColor','none')
xlabel('a*')
ylabel('b*')
zlabel('L*')
axis([-110 110 -110 110 0 100])
view(-10,35)
axis equal
title('sRGB gamut surface in L*a*b* space')
and it generates surface. But the problem that I can not export it as .obj file. Any suggestions?
2 个评论
采纳的回答
Pratheek Punchathody
2020-10-20
Exporting 3D graphics from MATLAB to the .OBJ file format is not directly supported. The concerned people are aware of this and might consider implementing it in any future release.
However, there is a third-party library Wavefront OBJ toolbox which has a function “write_wobj(OBJ,filename);” that can export 3D figure as an .obj file.
This is one of the several submissions in MATLAB File Exchange on MATLAB Central which is a forum for our product users to interact, exchange information and knowledge, without MathWorks' involvement. Feel free to contact the author of this submission directly for specific questions about the implementation".
As a workaround, OBJ file is basically a space separated text file, hence it should be possible to write and read .obj file as a table.
Hope this helps.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!