Povray code-j-srid.inc

This file is not complete at the moment.

```
/\* 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/>
 \*/

/\* Johnson solids based on a small rhombic dodecahedron \*/
#include "srid-reg.inc"

#local Phi2 = Phi \* Phi;
#local Phi3 = Phi \* Phi2;
#local NumGyrates = 0
#local Gyrates = array[5];
#local NumDiminishings = 0;
#local Diminishings = array[5];

#local FaceAdjustments = array[NumDoeFullFaces];
#for (F, 0, NumDoeFullFaces - 1, 1)
 #declare FaceAdjustments[F] = 0;
#end

#macro ProcessAdjustment(Face, Type)
 #declare FaceAdjustments[Face] = Type;
 #switch (Type)
 #case (1)
 #declare Diminishings[NumDiminishings] = Face;
 #declare NumDiminishings = NumDiminishings + 1;
 #break;
 #case (2)
 #declare Gyrates[NumGyrates] = Face;
 #declare NumGyrates = NumGyrates + 1;
 #end
#end

// Vertices
#local OldNumVertices = NumVertices;
#local OldVertices = Vertices;
#declare NumVertices = OldNumVertices - 15 \* Numdiminishes;
#declare Vertices = array[NumVertices];

#declare VertexMap = array[OldNumVertices];
#for (V, 0, OldNumVertices - 1, 1)
 #declare VertexMap[V] = 0;
#end

// Mark omited vertices
#for (F, 0, NumDiminishings - 1, 1)
 #local Face = Diminishings[F];
 #for (V, 0, 4, 1)
 #declare VertexMap[FullFaces[Face][V]] = -1;
 #end
#end

#local NextVertex = 0;
#for (V, 0, OldNumVertices - 1, 0)
 #if (VertexMap[V] = 0)
 #declare VertexMap[V] = NextVertex;
 #declare Vertex[NextVertex] = OldVertex[V];
 #declare NextVertex = NextVertex + 1;
 #end
#end

// Rotate gyrates
#local Scale = 2 \* sqrt(sqrt(5) / Phi3);
#for (F, 0, NumGyrates - 1, 1)
 #local Face = Gyrates[F];
 #local FaceCentre = <0, 0, 0>;
 #for (V, 0, 4, 1)
 #declare FaceCentre = FaceCentre + OldVertices[FullFaces[Face][V]];
 #end
 #declare FaceCentre = FaceCentre / 5;
 #for (V, 0, 4, 1)
 #local Vertex1 = OldVertices[FullFaces[Face][V]] - FaceCentre;
 #local Vertex2 = OldVertices[FullFaces[Face][mod(V + 1, 5)]] - FaceCentre;
 #local NewVertex = FaceCentre + (Vertex1 + Vertex2) \* Scale;
 #declare Vertices[VertexMap[FullFaces[Face][V]]] = NewVertex;
 #end
#end

// Edges
#local OldeNumEdges = NumEdges;
#local OldEdges = Edges;
#declare NumEdges = NumEdges - 15 \* NumDiminishings;
#declare Edges = array[NumEdges][2];

#local EdgeMap = array[NumEdges];
#local NextEdge = 0;
#for (E, 0, OldNumEdges - 1, 1)
 #if (VertexMap[OldEdges[E][0]] = -1 | VertexMap[OldEdges[E][1]] = -1)
 #declare EdgeMap[E] = -1;
 #else
 #declare EdgeMap[E] = NextEdge;
 #declare Edges[NextEdge][0] = VertexMap[OldEdges[E][0]];
 #declare Edges[NextEdge][1] = VertexMap[OldEdges[E][1]];
 #declare NextEdge = NextEdge + 1;
 #end
#end

#for (E, 0, NumGyrates - 1, 1)
 #local Face = Gyrates[E];
 #for (V, 0, 4, 1)
 #local OldVertex = DoeFullFaces[Face][V];
 #for (FF, 0, 2, 1)
 #if (IkeFaces[OldVertex][FF] = Face)
 #local Edge = EdgeMap[mod(IkeFaceEdges[OldVertex][mod(FF + 1, 3)],
 NumIkeEdges)];
 #declare Edges[Edge][0] =
 VertexMap[IkeFaces[OldVertex][mod(FF + 1, 3)]];
 #declare Edges[Edge][1] =
 VertexMap[PentagonFullFaces[Face][mod(V + 4, 5)]];
 #end
 #end
 #end
#end

// FullFaces
#declare NumFullFaces = 0;
#declare FullFaces = array[NumFullFaces + 1][10];

// Faces
#declare NumFaces = 0;
#declare Faces = array[NumFaces + 1][3];
#declare FaceTextureIndex = array[NumFaces + 1];

#declare OmitFaces = true;
/\*
#local OldNumFullFaces = NumFullFaces;
#local OldFullFaces = FullFaces;
#declare NumFullFaces = NumFullFaces - 10 \* NumDiminishings;
#declare FullFaces = array[NumFullFaces][10]];
#declare FullFaceSizes = array[NumFullFaces];
#local FullFaceTextures = array[NumFullFaces];

// Pentagons
#for (F, 0, NumPentagonFullFaces - 1, 1)
 #if (FaceAdjustments[F] = 1)
 #for (V, 0, 4, 1)
 #local Vtx = DoeFullFaces[F][V];
 #for (FF, 0, 2, 1)
 #if (IkeFaces[Vtx][FF] = F)
 #declare FullFaces[F][2 \* V] =
 VertexMap[IkeFaces[Vtx][mod(FF + 1, 3)]];
 #declare FullFaces[F][2 \* V + 1] =
 VertexMap[IkeFaces[Vtx][mod(FF + 2, 3)]];
 #end
 #end
 #end
 #declare FullFaceSizes[F] = 10;
 #declare FullFaceTextures[F] = MedialTexture;
 #else
 #for (V, 0, 4, 1)
 #declare FullFaces[F][V] = VertexMap[OldFullFaces[F][V]];
 #end
 #declare FullFaceSizes[F] = 5;
 #declare FullFaceTextures[F] = BaseTexture;
 #end
#end

// Squares
#local NextFullFace = NumPentagonFullFaces;
#for (E, 0, NumSquareFullFaces - 1, 1)
 #local FA0 = FaceAdjustments[IkeEdges[E][0]];
 #local FA1 = FaceAdjustments[IkeEdges[E][1]];
 #if (FA0 != 0 & FA1 != 0
 #error "Cannot modify adjacent faces"
 #end
 #local FA = FA0 + FA1;
 #if (FA != 1)
 #if (FA0 = 2)

 #elseif (FA1 = 2)

 #else
 #for (V, 0, 3, 1)
 #declare FullFaces[NextFullFace][V] = VertexMap[OldFullFaces[E][V]];
 #end
 #end
 #declare FullFaceSizes[NextFullFace] = 4;
 #declare FullFaceTextures = RhombTextures;
 #declare NextFullFace = NextFullFace + 1;
 #end
#end

// Triangles
#for (F, 0, NumTriangleFaces - 1, 1)
 #local FA0 = FaceAdjustments[IkeFaces[F][0]];
 #local FA1 = FaceAdjustments[IkeFaces[F][1]];
 #local FA2 = FaceAdjustments[IkeFaces[F][2]];
 #local FA = FA0 + FA1 + FA2;
 #if (FA != 1)
 #if (FA0 = 2)

 #elseif (FA1 = 2)

 #elseif (FA2 = 2)

 #else

 #end
 #declare FullFaceSizes[NextFullFace] = 3;
 #declare FullFace%extures[NextFullFace] = DualTextures;
 #declare NextFullFace = NextFullFace + 1;
 #end
\*/

```