Povray code-srid-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 rhombicosidodecahedron regiment \*/

#include "ike-sym.inc"

#declare NumVertices = 3 \* NumDoeVertices;
#declare Vertices = array[NumVertices];

#for (F, 0, NumDoeFullFaces - 1, 1)
 #for (V, 0, 4, 1)
 #local Vertex = DoeFullFaces[F][V];
 #declare Vertices[5 \* F + V] = DoeVertices[Vertex] + IkeVertices[F];
 #end
#end

#declare Circumradius = sqrt(11 + 4 \* sqrt(5));

// Edges
#declare NumEdges = 5 \* NumDoeFullFaces + 3 \* NumIkeFaces;
#declare Edges = array[NumEdges][2];

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

#for (F, 0, NumIkeFaces - 1, 1)
 #for (E, 0, 2, 1)
 #local Face = IkeFaces[F][E];
 #for (FF, 0, 4, 1)
 #if (DoeFullFaces[Face][FF] = F)
 #declare Edges[TriBase + 3 \* F + E][0] = 5 \* Face + FF;
 #declare Edges[TriBase + 3 \* F + mod(E + 1, 3)][1] = 5 \* Face + FF;
 #end
 #end
 #end
#end

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

#include "macros.inc"

// Pentagon
#for (F, 0, NumPentagonFullFaces - 1, 1)
 #local To = PentagonFullFacesStart + F;
 #for (V, 0, 4, 1)
 #declare FullFaces[To][V] = 5 \* F + V;
 #end
 #declare FullFaceSizes[To] = 5;
#end

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

// Square
#for (F, 0, NumSquareFullFaces - 1, 1)
 #local To = SquareFullFacesStart + F;
 #local DoeFaceA = IkeEdges[F][0];
 #local DoeFaceB = IkeEdges[F][1];
 #local IkeFaceA = DoeEdges[F][0];
 #local IkeFaceB = DoeEdges[F][1];
 #local Vert = array[4];
 #for (V, 0, 4, 1)
 #if (DoeFullFaces[DoeFaceA][V] = IkeFaceA)
 #declare Vert[0] = 5 \* DoeFaceA + V;
 #else
 #if (DoeFullFaces[DoeFaceA][V] = IkeFaceB)
 #declare Vert[1] = 5 \* DoeFaceA + V;
 #end
 #end
 #if (DoeFullFaces[DoeFaceB][V] = IkeFaceA)
 #declare Vert[2] = 5 \* DoeFaceB + V;
 #else
 #if (DoeFullFaces[DoeFaceB][V] = IkeFaceB)
 #declare Vert[3] = 5 \* DoeFaceB + V;
 #end
 #end
 #end
 #declare FullFaces[To][0] = Vert[0];
 #declare FullFaces[To][1] = Vert[1];
 #if (vlength(Vertices[Vert[0]] - Vertices[Vert[3]]) > 3)
 #declare FullFaces[To][2] = Vert[2];
 #declare FullFaces[To][3] = Vert[3];
 #else
 #declare FullFaces[To][2] = Vert[3];
 #declare FullFaces[To][3] = Vert[2];
 #end
 #declare FullFaceSizes[To] = 4;
#end

// Decagon
#for (F, 0, NumDecagonFullFaces - 1, 1)
 #local To = DecagonFullFacesStart + F;
 #for (E, 0, 4, 1)
 #local Edge = mod(DoeFaceEdges[F][E], NumDoeEdges);
 #local AdjFace = IkeEdges[Edge][0] + IkeEdges[Edge][1] - F;
 #for (EE, 0, 4, 1)
 #if (mod(DoeFaceEdges[AdjFace][EE], NumDoeEdges) = Edge)
 #declare FullFaces[To][2 \* E] = 5 \* AdjFace + EE;
 #declare FullFaces[To][2 \* E + 1] = 5 \* AdjFace + mod(EE + 1, 5);
 #end
 #end
 #end
 #declare FullFaceSizes[To] = 10;
#end

// Faces
#declare NumPentagonFaces = 2 \* NumPentagonFullFaces;
#declare NumTriangleFaces = NumTriangleFullFaces;
#declare NumSquareFaces = 2 \* NumSquareFullFaces;
#declare NumDecagonFaces = 6 \* NumDecagonFullFaces;

#declare PentagonFaces = array[NumPentagonFaces][3];
#declare TriangleFaces = array[NumTriangleFaces][3];
#declare SquareFaces = array[NumSquareFaces][3];
#declare DecagonFaces = array[NumDecagonFaces][3];

TriangulateConvex(PentagonFaces, 0, PentagonFullFacesStart,
 NumPentagonFullFaces, 5)
TriangulateConvex(TriangleFaces, 0, TriangleFullFacesStart,
 NumTriangleFullFaces, 3)
TriangulateConvex(SquareFaces, 0, SquareFullFacesStart, NumSquareFullFaces, 4)
TriangulateConvex(DecagonFaces, 0, DecagonFullFacesStart, NumDecagonFullFaces,

```