Povray code-did-reg.inc

```
/\* This program is free software: you can redistribute it and/or modify it
 \* under the terms of the GNU General Public License as published by the Free
 \* Software Foundation, either version 3 of the License, or (at your option)
 \* any later version.
 \*
 \* This program is distributed in the hope that it will be useful, but WITHOUT
 \* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 \* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 \* more details.
 \*
 \* You should have received a copy of the GNU General Public License along with
 \* this program. If not, see <http://www.gnu.org/licenses/>
 \*/

/\* Dodecadodecahedron regiment \*/

#include "ike-sym.inc"

// Vertices
#declare NumVertices = NumIkeEdges;
#declare NextUnusedVertex = NumVertices;
#declare NumVirtualVertices = 5 \* NumDoeFullFaces;
#declare Vertices = array[NumVertices + NumVirtualVertices];

#for (V, 0, NumVertices - 1, 1)
 #declare Vertices[V] = (IkeVertices[IkeEdges[V][0]] +
 IkeVertices[IkeEdges[V][1]]) / Phi;
#end

#declare Circumradius = 2;

// Edges
#declare NumEdges = 2 \* NumDoeEdges;
#declare Edges = array[NumEdges][2];

#for (F, 0, NumDoeFullFaces - 1, 1)
 #for (E, 0, 4, 1)
 #local E1 = mod(2 \* E, 5);
 #declare Edges[5 \* F + E][0] = mod(DoeFaceEdges[F][E1], NumVertices);
 #declare Edges[5 \* F + E][1] = mod(DoeFaceEdges[F][mod(E1 + 2, 5)],
 NumVertices);
 #end
#end

// Full Faces
#declare PentagonFullFacesStart = 0;
#declare NumPentagonFullFaces = NumDoeFullFaces;
#declare PentagramFullFacesStart = PentagonFullFacesStart +
 NumPentagonFullFaces;
#declare NumPentagramFullFaces = NumDoeFullFaces;
#declare HexagonFullFacesStart = PentagramFullFacesStart +
 NumPentagramFullFaces;
#declare NumHexagonFullFaces = NumDoeEdges / 3;
#declare NumFullFaces = HexagonFullFacesStart + NumHexagonFullFaces;
#declare FullFaces = array[NumFullFaces][6];
#declare FullFaceSizes = array[NumFullFaces];

#include "macros.inc"

// Pentagons
#for (F, 0, NumPentagonFullFaces - 1, 1)
 #local To = PentagonFullFacesStart + F;
#debug concat("F: ", str(F, 2, 0), " - {")
 #for (V, 0, 4, 1)
 #local Edge = mod(DoeFaceEdges[F][V], NumDoeEdges);
 #local AdjFace = IkeEdges[Edge][0] + IkeEdges[Edge][1] - F;
#if (V != 0)
 #debug ", "
#end
#debug str(AdjFace, 2, 0)
// Find which edge of the adjacent face is connected
 #for (E, 0, 4, 1)
 #if (mod(DoeFaceEdges[AdjFace][E], NumDoeEdges) = Edge)
 #declare FullFaces[To][V] = Edges[5 \* AdjFace + mod(3 \* E + 3, 5)][0];
 #end
 #end
 #end
#debug "}\n"
 #declare FullFaceSizes[To] = 5;
#end

// Pentagrams
#for (F, 0, NumPentagramFullFaces - 1, 1)
 #local To = PentagramFullFacesStart + F;
 #for (V, 0, 4, 1)
 #declare FullFaces[To][V] = Edges[5 \* F + V][0];
 #end
 #declare FullFaceSizes[To] = 5;
#end

// Hexagons
GetMedialPolygons(HexagonFullFacesStart, NumHexagonFullFaces, 6)

// Faces
#declare NumPentagonFaces = 3 \* NumPentagonFullFaces;
#declare NumPentagramFaces = NumPieces5\_2 \* NumPentagramFullFaces;
#declare NumHexagonFaces = 4 \* NumHexagonFullFaces;

#declare PentagonFaces = array[NumPentagonFaces][3];
#declare PentagramFaces = array[NumPentagramFaces][3];
#declare HexagonFaces = array[NumHexagonFaces][3];

TriangulateConvex(PentagonFaces, 0, PentagonFullFacesStart,
 NumPentagonFullFaces, 5)
Triangulate5\_2(PentagramFaces, 0, PentagramFullFacesStart,
 NumPentagramFullFaces)
TriangulateConvex(HexagonFaces, 0, HexagonFullFacesStart, NumHexagonFullFaces,

```