Computing Polygonal Surface in Matlab

248 Views Asked by At

I am given a bunch of points in 3D-space and want to analyze their convex hull. What I am interested in is what kinds of polygons appear on the surface of the convex hull (probably mostly triangles, but maybe there are also quadrilaterals, etc). To get a picture of this, I tried to plot it in Matlab, but I was not able to compute the polygons that form the surface. The best I could do is to plot the surface triangulated (using "convhull").

Does anyone know whether it is possible to compute the polygons and not just get the surface triangulated? I fear that it is not possible; if not, is there an alternative plotting software that might be able to do this?

Edit: Following John's answer below, I finally got a solution to this problem. Basically, I use "convhull" to get the convex hull as a triangulated surface, then I compute the face normals (using "faceNormals") and use them to color all triangles with the same normals in the same color.

1

There are 1 best solutions below

5
On BEST ANSWER

Matlab wants to draw triangles, not polygons, generally. (In the plane, it'll draw polygons).

One solution: draw the triangles using surf or patch, but set the EdgeColor to 'none'; then draw all the edges that you want, preferably with a LineWidth that's a little bit large, so that it won't get hidden by the polygons. Better still is to offset the lines ever so slightly; since your surface is convex, you can do this by expanding it by, say, 1% about its center of mass. I'd use plot3 to draw the lines, by the way.