# How can I build an array of coordinates of a truncated icosahedron's faces?

I can easily get a list of coordinates of all the vertices—the Wikipedia page has formulae and this page has a list of them, but that doesn't tell me which ones are part of which face.

What I'd like is to create an array of 32 faces, and for each one have:

• The 3-coordinate of the center of the face
• The rotation of the face about the center point
• Whether it's a pentagon or a hexagon

How can I generate that data?

• To be honest I usually just hard-code the topology at the first level — a paper model I can draw on helps me keep track of my numbering — and then only try to get clever about generating topology when aubdividing/tessellating from that hard-coded base. May 19, 2019 at 8:07
• I have to generate the data before I can hard code it... May 20, 2019 at 22:28

I'd suggest you use Blender. It's easy to get the information you want for any geometric object you create, using python scripts. It's free, easy to use and you can get extensive support online.

2) Check this question, first answer, to create easily a truncated icosahedron https://blender.stackexchange.com/questions/31727/truncated-icosahedron

3) Go to "Objects mode" and select your geometry (right mouse button).

4) Open the python console by pressing Shift-F4. Copy and paste this script:

import bpy, bmesh
obj = bpy.context.active_object
verts = [vert.co.to_tuple() for vert in obj.data.vertices]
faces = [ [ vertex for vertex in face.vertices ] for face in obj.data.polygons]


Now verts is a list of the coordinates of all the vertices, and faces is a list of all the faces. Each face is a list of indices referencing to the verts list. You can inspect them using print verts and print faces. I would suggest you save them to a file, using numpy for example.

• Thanks. That looks useful. I think what I ultimately need is to calculate a transformation from the origin to a face. I can get the translation by averaging the vertices of the face. Can I get the rotation also? May 20, 2019 at 22:32
• @DanEllis hint: if the polyhedron is centered at the origin, the face center IS the face normal. May 21, 2019 at 1:09
• @Turms Okay, so each polygon has a center attribute, which I can use as the translation. But what about the rotation? There's a normal attribute, so can I use that somehow? Or will that only give me the rotation of the plane the face is on, and not include the actual orientation of the pentagon or hexagon? May 21, 2019 at 5:18
• The orientation of the plane (given by the normal) of the pentagon is the same as the orientation of the pentagon. Or do you mean the rotation of the pentagon around its normal axis? May 21, 2019 at 6:43
• @Turms Right, exactly. It needs to include the rotation around the normal axis. May 21, 2019 at 18:09