Povray code-j-tid.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/>
 \*/

/\* Augmented truncated cube \*/
#include "poly-textures.inc"

#include "ike-sym.inc"

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

#local AugmentedFaces = array[3];
#local NumAugmentings = 0;
#macro Augment(Face)
 #declare FacesStatus[Face] = 1;
 #declare AugmentedFaces[NumAugmentings] = Face;
 #declare NumAugmentings = NumAugmentings + 1;
#end

#ifdef (AugmentBase)
 Augment(0)
#end
#ifdef (AugmentPara)
 Augment(3)
#end
#ifdef (AugmentMeta)
 Augment(2)
#end
#ifdef (AugmentThird)
 Augment(10)
#end

#declare NumPolyVertices = NumDoeVertices;
#declare PolyVertices = DoeVertices;
#declare NumPolyEdges = NumDoeEdges;
#declare PolyEdges = DoeEdges;
#declare NumPolyFaces = NumDoeFullFaces;
#declare PolyFaces = DoeFullFaces;
#declare ReserveVertices = 5 \* NumAugmentings;
#include "trunc.inc"

// Vertices
#local OldNumVertices = NumVertices;
#declare NumVertices = NumVertices + ReserveVertices;
#include "macros.inc"
#local MidEdgeScale = 2 / Phi / sqrt(5);
#local MidFaceScale = 1.723606797; // TODO: What is this figure?
#for (F, 0, NumAugmentings - 1, 1)
 #local Face = AugmentedFaces[F];
 #local MP = IkeVertices[Face];
 #for (V, 0, 4, 1)
 #local To = OldNumVertices + 5 \* F + V;
 #local Edge = mod(DoeFaceEdges[Face][V], NumDoeEdges);
 #local MidEdge = (Vertices[2 \* Edge] + Vertices[2 \* Edge + 1]) / 2;
#debug concat("F: ", str(F, 1, 0), ", V: ", str(V, 1, 0), ", MidEdge: ", VStr(MidEdge), ", MP: ", VStr(MP), "\n")
 #declare Vertices[To] = MidEdge \* MidEdgeScale + MP \* MidFaceScale;
 #end
#end

#declare Circumradius = 6.266618691; // TODO: What is this figure?
// Edges
#local OldNumEdges = NumEdges;
#declare NumEdges = NumEdges + 15 \* NumAugmentings;
#local OldEdges = Edges;

#declare Edges = array[NumEdges][2];
#for (E, 0, OldNumEdges - 1, 1)
 #declare Edges[E][0] = OldEdges[E][0];
 #declare Edges[E][1] = OldEdges[E][1];
#end
#for (A, 0, NumAugmentings - 1, 1)
 #local To = OldNumEdges + 15 \* A;
 #local Face = AugmentedFaces[A];
 #for (E, 0, 4, 1)
 #local Vert = OldNumVertices + 5 \* A;
 #declare Edges[To + 3 \* E][0] = FullFaces[Face][2 \* E];
 #declare Edges[To + 3 \* E][1] = Vert + E;
 #declare Edges[To + 3 \* E + 1][0] = FullFaces[Face][2 \* E + 1];
 #declare Edges[To + 3 \* E + 1][1] = Vert + E;
 #declare Edges[To + 3 \* E + 2][0] = Vert + E;
 #declare Edges[To + 3 \* E + 2][1] = Vert + mod(E + 1, 5);
 #end
#end

// Full Faces
#local OldNumFullFaces = NumFullFaces;
#local OldFullFaces = FullFaces;
#local OldFullFaceSizes = FullFaceSizes;
#declare NumFullFaces = NumFullFaces + 10 \* NumAugmentings;
#declare FullFaces = array[NumFullFaces][10];
#declare FullFaceSizes = array[NumFullFaces];
#declare FullFaceTextures = array[NumFullFaces];

#for (F, 0, OldNumFullFaces - 1, 1)
 #for (V, 0, OldFullFaceSizes[F] - 1, 1)
 #declare FullFaces[F][V] = OldFullFaces[F][V];
 #end
 #declare FullFaceSizes[F] = OldFullFaceSizes[F];
 #declare FullFaceTextures[F] = BaseTexture;
#end

#for (A, 0, NumAugmentings - 1, 1)
 #local Face = AugmentedFaces[A];
 #local NewVerticesBase = OldNumVertices + 5 \* A;
 // Firstly, make old face the cap of the augment
 #for (V, 0, 4, 1)
 #declare FullFaces[Face][V] = NewVerticesBase + V;
 #end
 #declare FullFaceSizes[Face] = 5;
 #declare FullFaceTextures[Face] = MedialTexture;

 // Now the eight new faces
 #local To = OldNumFullFaces + 10 \* A;
 #for (V, 0, 9, 1)
 #declare FullFaces[To + V][0] = OldFullFaces[Face][V];
 #declare FullFaces[To + V][1] = OldFullFaces[Face][mod(V + 1, 10)];
 #end
 #for (V, 0, 4, 1)
 #declare FullFaces[To + 2 \* V][2] = NewVerticesBase + V;
 #declare FullFaces[To + 2 \* V + 1][2] = NewVerticesBase + mod(V + 1, 5);
 #declare FullFaces[To + 2 \* V + 1][3] = NewVerticesBase + V;
 #declare FullFaceSizes[To + 2 \* V] = 3;
 #declare FullFaceSizes[To + 2 \* V + 1] = 4;
 #declare FullFaceTextures[To + 2 \* V] = SnubTexture;
 #declare FullFaceTextures[To + 2 \* V + 1] = RhombTexture;
 #end
#end

// Faces
#declare NumFaces = 8 \* NumDoeFullFaces + NumDoeVertices +
 10 \* NumAugmentings;
#declare Faces = array[NumFaces][3];
#declare FaceTextureIndex = array[NumFaces];

#local NextFace = 0;
#for (FF, 0, NumFullFaces - 1, 1)
 #for (F, 0, FullFaceSizes[FF] - 3, 1)
 #declare Faces[NextFace][0] = FullFaces[FF][0];
 #declare Faces[NextFace][1] = FullFaces[FF][F + 1];
 #declare Faces[NextFace][2] = FullFaces[FF][F + 2];
 #declare FaceTextureIndex[NextFace] = FullFaceTextures[FF];
 #declare NextFace = NextFace + 1;
 #end
#end

```