Povray code-gid-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/>
 \*/

/\* Great icosidodecahedron regiment \*/

#include "id-reg.inc"

#local NumVirtualVertices = 5 \* NumDoeFullFaces + 20 \* NumIkeFaces;
#local OldVertices = Vertices;
#declare Vertices = array[NumVertices + NumVirtualVertices];
#for (V, 0 NumVertices - 1, 1)
 #declare Vertices[V] = OldVertices[V] / Phi / Phi;
#end

#declare Circumradius = 2 / Phi;

// Edges
#local OldEdges = Edges;
#local OldNumEdges = NumEdges;

#declare NumEdges = 5 \* NumPentFullFaces;
#declare Edges = array[NumEdges][2];

#for (F, 0, NumPentFullFaces - 1, 1)
 #local From = PentFullFacesStart + F;
 #for (E, 0, 4, 1)
 #local Edge = mod(DoeFaceEdges[F][mod(2 \* E, 5)], NumDoeEdges);
 #local AdjFace = IkeEdges[Edge][0] + IkeEdges[Edge][1] - F;
 #local To = 5 \* F + E;
 #for (EE, 0, 4, 1)
 #if (mod(DoeFaceEdges[AdjFace][EE], NumDoeEdges) = Edge)
 #local V = mod(DoeFaceEdges[AdjFace][mod(EE + 1, 5)], NumDoeEdges);
 #declare Edges[5 \* F + E][0] = V;
 #declare Edges[5 \* F + mod(E + 1, 5)][1] = V;
 #end
 #end
 #end
#end

// Full faces
#declare PentagramFullFacesStart = 0;
#declare NumPentagramFullFaces = NumDoeFullFaces;
#declare TriangleFullFacesStart = PentagramFullFacesStart +
 NumPentagramFullFaces;
#declare NumTriangleFullFaces = NumIkeFaces;
#declare DecagramFullFacesStart = TriangleFullFacesStart +
 NumTriangleFullFaces;
#declare NumDecagramFullFaces = NumDoeFullFaces / 2;
#declare NumFullFaces = DecagramFullFacesStart + NumDecagramFullFaces;
#declare FullFaces = array[NumFullFaces][10];
#declare FullFaceSizes = array[NumFullFaces];

#include "macros.inc"

// Pentagram
#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

// Triangle
#for (F, 0, NumTriangleFullFaces - 1, 1)
 #local To = TriangleFullFacesStart + F;
 #for (E, 0, 2, 1)
 #local Face = IkeFaces[F][E];
 #for (V, 0, 4, 1)
 #if (DoeFullFaces[Face][V] = F)
 #declare FullFaces[To][E] = mod(DoeFaceEdges[Face][mod(V + 2, 5)],
 NumDoeEdges);
 #end
 #end
 #end
 #declare FullFaceSizes[To] = 3;
#end

// Decagram
GetMedialPolygons(DecagramFullFacesStart, NumDecagramFullFaces, 10)

// Faces
#declare NumPentagramFaces = NumPieces5\_2 \* NumPentagramFullFaces;
#declare NumTriangleFaces = NumTriangleFullFaces;
#declare NumDecagramFaces = NumPieces10\_3 \* NumDecagramFullFaces;

#declare PentagramFaces = array[NumPentagramFaces][3];
#declare TriangleFaces = array[NumTriangleFaces][3];
#declare DecagramFaces = array[NumDecagramFaces][3];

Triangulate5\_2(PentagramFaces, 0, PentagramFullFacesStart,
 NumPentagramFullFaces)
TriangulateConvex(TriangleFaces, 0, TriangleFullFacesStart,
 NumTriangleFullFaces, 3)
Triangulate10\_3(DecagramFaces, 0, DecagramFullFacesStart, NumDecagramFullFaces)

```