How to compute projections of 3D meshes in matlab

独自空忆成欢 提交于 2019-12-10 11:25:26

问题


I'm trying to compute 2d projections of a 3d mesh from different views using matlab. The solution I m using now, is to plot the 3d mesh, rotate it, and make a screenshot.

I would like to know if there is any matlab internal functions or any other solution that allow me, given a set of vertices and triangles, to compute the projections without having to plot the 3D mesh

Thanks


回答1:


You can use the view command to rotate the axes and change the viewpoint. The azimuth and elevation are given in degrees (ref. documentation for more info). Here's a small example:

ha=axes;
[x,y,z]=peaks;
surf(x,y,z);
xlabel('x');ylabel('y');zlabel('z')

%#projection on the X-Z plane
view(ha,[0,0])

%#projection on the Y-Z plane
view(ha,[90,0])

%#projection on the X-Y plane
view(ha,[0,90])

This is what it looks like:

Projections on different 2D planes

X-Z

Y-Z

X-Y



来源:https://stackoverflow.com/questions/6180841/how-to-compute-projections-of-3d-meshes-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!