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

/\* Small ditrigonary icosidodecahedron regiment \*/

#include "ike-sym.inc"

#declare NumVertices = NumDoeVertices;
#declare NumVirtualVertices = 5 \* NumDoeFullFaces;
#declare Vertices = array[NumVertices + NumVirtualVertices];
#local NextVertex = NumVertices;

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

#declare Circumradius = sqrt(3);

// Edges
#declare NumEdges = 2 \* NumDoeEdges;
#declare Edges = array[NumEdges][2];
#for (F, 0, NumDoeFullFaces - 1, 1)
 #for (V, 0, 4, 1)
 #declare Edges[5 \* F + V][0] = DoeFullFaces[F][mod(2 \* V, 5)];
 #declare Edges[5 \* F + V][1] = DoeFullFaces[F][mod(2 \* V + 2, 5)];
 #end
#end

// Full Faces
#declare PentagramFullFacesStart = 0;
#declare NumPentagramFullFaces = NumDoeFullFaces;
#declare TriangleFullFacesStart = PentagramFullFacesStart +
 NumPentagramFullFaces;
#declare NumTriangleFullFaces = NumIkeFaces;
#declare SquareFullFacesStart = TriangleFullFacesStart + NumTriangleFullFaces;
#declare NumSquareFullFaces = NumDoeEdges;
#declare PentagonFullFacesStart = SquareFullFacesStart + NumSquareFullFaces;
#declare NumPentagonFullFaces = NumDoeFullFaces;
#declare NumFullFaces = PentagonFullFacesStart + NumPentagonFullFaces;
#declare FullFaces = array[NumFullFaces][5];
#declare FullFaceSizes = array[NumFullFaces];

#include "macros.inc"

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

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

// Square
#for (F, 0, NumSquareFullFaces - 1, 1)
 #local To = F + SquareFullFacesStart;
 #local DoeFaceA = IkeEdges[F][0];
 #local DoeFaceB = IkeEdges[F][1];
 #for (E, 0, 4, 1)
 #if (mod(DoeFaceEdges[DoeFaceA][E], NumDoeEdges) = F)
 #declare FullFaces[To][0] = DoeFullFaces[DoeFaceA][mod(E + 2, 5)];
 #declare FullFaces[To][1] = DoeFullFaces[DoeFaceA][mod(E + 4, 5)];
 #end
 #if (mod(DoeFaceEdges[DoeFaceB][E], NumDoeEdges) = F)
 #declare FullFaces[To][2] = DoeFullFaces[DoeFaceB][mod(E + 2, 5)];
 #declare FullFaces[To][3] = DoeFullFaces[DoeFaceB][mod(E + 4, 5)];
 #end
 #end
 #declare FullFaceSizes[To] = 4;
#end

// Pentagon
#for (F, 0, NumPentagonFullFaces - 1, 1)
 #local To = F + PentagonFullFacesStart;
 #for (E, 0, 4, 1)
 #local Edge = mod(DoeFaceEdges[F][E], NumDoeEdges);
 #local AdjPent = IkeEdges[Edge][0] + IkeEdges[Edge][1] - F;
 #for (EE, 0, 4, 1)
 #if (mod(DoeFaceEdges[AdjPent][EE], NumDoeEdges) = Edge)
 #declare FullFaces[To][E] = DoeFullFaces[AdjPent][mod(EE + 2, 5)];
 #end
 #end
 #end
 #declare FullFaceSizes[To] = 5;
#end

// Faces
#declare NumPentagramFaces = NumPieces5\_2 \* NumPentagramFullFaces;
#declare NumTriangleFaces = NumTriangleFullFaces;
#declare NumSquareFaces = 2 \* NumSquareFullFaces;
#declare NumPentagonFaces = 3 \* NumPentagonFullFaces;

#declare PentagramFaces = array[NumPentagramFaces][3];
#declare TriangleFaces = array[NumTriangleFaces][3];
#declare SquareFaces = array[NumSquareFaces][3];
#declare PentagonFaces = array[NumPentagonFaces][3];

Triangulate5\_2(PentagramFaces, 0, PentagramFullFacesStart,
 NumPentagramFullFaces)
#debug "Triangles\n"
TriangulateConvex(TriangleFaces, 0, TriangleFullFacesStart,
 NumTriangleFullFaces, 3)
#debug "Squares\n"
TriangulateConvex(SquareFaces, 0, SquareFullFacesStart, NumSquareFullFaces, 4)
#debug "Pentagons\n"
TriangulateConvex(PentagonFaces, 0, PentagonFullFacesStart,
 NumPentagonFullFaces, 5)

```