2
votes

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

1 Answers

1
votes

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:

enter image description here

Projections on different 2D planes

X-Z

enter image description here

Y-Z

enter image description here

X-Y

enter image description here