Building polyhedra from sets of vertices and faces

This notebook illustrates how to generate the graphic representation of polyhedra if you know the coordinates of the vertices and the sets of vertices which determine each face. The VerticesToSolid function is courtesy of Eric Weisstein.

The parts

First we create a set of vertices and faces for the solid. Keep in mind that Mathematica will not check to see if your faces are flat and so if you are not sure you should make all the faces triangular.

verts  =  {{0, 0, -1}, {0, 0, 1}, {2, -1, -1/2}, {2, 
          1, -1/2}, {-1, 1/2, 1}, {-1, -1/2, 
          1}, {-2, -1, 0}, {-2, 1, 0}}

faces  =  {{1, 2, 5, 8}, {1, 7, 8}, {1, 2, 6, 7}, {2, 5, 6}, {1, 2, 
          4}, {1, 2, 3}, {1, 3, 4}, {2, 3, 4}, {5, 6, 7, 8}}

The function

The function VerticesToSolid converts the above lists to a solid. It can be used directly in show.

VerticesToSolid[v_List, f_List] := Polygon[v[[#]]] & /@ 
        f

Displaying the solid

Here we display the solid using Show.

Show[Graphics3D[VerticesToSolid[verts, faces]], Boxed -> False, 
      ViewPoint -> {3.339,  -4.595,  1.223}]

Here we change the ViewPoint.

Show[Graphics3D[VerticesToSolid[verts, faces]], Boxed -> False, 
      ViewPoint -> {-3.078,  -2.920,  3.969}]