I'm a newbie here, and I'm not a mathematician, so I hope you could help me. Online I found that the 20 vertex of a dodecahedron can be easily expressed as:
p = (1 + np.sqrt(5)) / 2 # The golden ratio
i = 2 / (1 + np.sqrt(5)) # The golden ratio inverse
vertices = []
vertices.append(Point3D(+i, 0, +p)) # 0
vertices.append(Point3D(-i, 0, +p)) # 1
vertices.append(Point3D(-i, 0, -p)) # 2
vertices.append(Point3D(+i, 0, -p)) # 3
vertices.append(Point3D(+p, +i, 0)) # 4
vertices.append(Point3D(+p, -i, 0)) # 5
vertices.append(Point3D(-p, -i, 0)) # 6
vertices.append(Point3D(-p, +i, 0)) # 7
vertices.append(Point3D(0, +p, +i)) # 8
vertices.append(Point3D(0, +p, -i)) # 9
vertices.append(Point3D(0, -p, -i)) # 10
vertices.append(Point3D(0, -p, +i)) # 11
vertices.append(Point3D(+1, +1, +1)) # 12
vertices.append(Point3D(+1, -1, +1)) # 13
vertices.append(Point3D(-1, -1, +1)) # 14
vertices.append(Point3D(-1, +1, +1)) # 15
vertices.append(Point3D(-1, +1, -1)) # 16
vertices.append(Point3D(+1, +1, -1)) # 17
vertices.append(Point3D(+1, -1, -1)) # 18
vertices.append(Point3D(-1, -1, -1)) # 19
Assuming that the edge obtained by a couple of vertices with index (m,n) is the same of (n,m), I manually find that the 30 couples are:
edges = []
edges.append([0, 12])
edges.append([12, 4])
edges.append([4, 5])
edges.append([5, 13])
edges.append([13, 0])
edges.append([9, 8])
edges.append([8, 15])
edges.append([15, 1])
edges.append([1, 14])
edges.append([14, 11])
edges.append([11, 10])
edges.append([10, 18])
edges.append([18, 3])
edges.append([3, 17])
edges.append([17, 9])
edges.append([6, 7])
edges.append([7, 16])
edges.append([16, 2])
edges.append([2, 19])
edges.append([19, 6])
edges.append([0, 1])
edges.append([12, 8])
edges.append([4, 17])
edges.append([5, 18])
edges.append([13, 11])
edges.append([14, 6])
edges.append([15, 7])
edges.append([9, 16])
edges.append([3, 2])
edges.append([10, 19])
Is there a way to obtain those couples programmatically?
Thanks
If you already have the edges programmed in manually, then you don't really need to generate them programmatically, right? But there is still a way to generate them with code:
Just check, for each sorted pair of points, whether their distance is (approximately) equal to a given distance (for example the distance between vertices 0 and 12), if yes, add an edge between them.