

(*This file contains the definitions of the tiles from
the paper.  After the tiles are defined, we define some
plotting routines.  The first plotting routine draws
the tiles in Mathematica.  The second set of routines
outputs the tiles to a file called out_to_tcl.  This
file is then read by the tcl program tcl_plotter.*)

(*load in the file special_points. This file in turn
loads in the files <algebra> and <group_elements>  *)

<<special_points



(*the tiles:  given as lists of complex numbers *)

EvenTileA[j_]:={
PlaneA[j],
AlphaMinus[j+0],
AlphaPlus[j-10],
BetaPlus[j-8],
AlphaPlus[j-3],
AlphaPlus[j+0],
AlphaMinus[j+10],
BetaMinus[j+8],
AlphaMinus[j+3]};

OddTileA[j_]:={PlaneA[j],
AlphaMinus[j+0],
BetaMinus[j+5],
AlphaPlus[j+0],
BetaPlus[j-5]};

TileA[j_]:=(n=Mod[j,2];
If[n==0,EvenTileA[j],OddTileA[j]])

TileB[j_]:={
PlaneB[j],
BetaMinus[j+0],
AlphaMinus[j+2],
AlphaMinus[j+5],
BetaPlus[j+0],
AlphaPlus[j-2],
AlphaPlus[j-5]};




(*Mathematica Plots: a,b,c are RGB listings for colors*)

(*Make a polygon from a list of complex numbers*)
MakePolygon[XX_]:=
Polygon[Table[{Re[XX[[j]]],Im[XX[[j]]]},{j,1,Length[XX]}]];

(*Make a line from a list of complex numbers*)
MakeLine[XX_]:=
Line[Table[{Re[XX[[j]]],Im[XX[[j]]]},{j,1,Length[XX]}]];

ColoredTile[X_,a_,b_,c_]:=(
Y=Take[X,{2,Length[X]}];
L=Length[Y];
{
RGBColor[a[[1]],a[[2]],a[[3]]],
MakePolygon[Y],
RGBColor[0,0,0],
MakeLine[Y],
MakeLine[RotateLeft[Y,1]],
RGBColor[b[[1]],b[[2]],b[[3]]],
Line[{{Re[Y[[1]]],Im[Y[[1]]]},{Re[Y[[L/2+1]]],Im[Y[[L/2+1]]]}}],
PointSize[.01],
RGBColor[c[[1]],c[[2]],c[[3]]],
Point[{Re[X[[1]]],Im[X[[1]]]}]})

(*Here is an example, which draws the tile A[0] blue,
with symmetry axis red:
Show[Graphics[ColoredTile[TileA[0],{0,0,1},{1,0,0},{0,0,0}]]]
*)
Show[Graphics[{ColoredTile[TileA[0],{0,0,1},{1,0,0},{0,0,0}],
               ColoredTile[TileA[1],{1,0,1},{1,0,0},{0,0,0}],
               ColoredTile[TileB[0],{0,1,1},{1,1,0},{0,0,0}]}]]



(*tcl output.  We used these routines to generate
the pictures in the paper.*)

EdgeWrite[col_,file_,vv_,ww_]:=(
v=vv//N;
w=ww//N;
Write[file,1];
Write[file,col];
Write[file,Re[v]];
Write[file,Im[v]];
Write[file,col];
Write[file,Re[w]];
Write[file,Im[w]];)

TclTile1[X_]:=(
OpenWrite["out_to_tcl"];
L=Length[X];
i=2;
Do[{EdgeWrite[1,"out_to_tcl",X[[i]],X[[i+1]]];i=i+1},{i,2,L-1}];
EdgeWrite[1,"out_to_tcl",X[[2]],X[[L]]];
L=Length[X];
i=2;
Do[{EdgeWrite[2,"out_to_tcl",X[[1]],X[[i]]];i=i+1},{i,1,L}];
EdgeWrite[1,"out_to_tcl",X[[2]],X[[(L-1)/2+2]]];
Close["out_to_tcl"];
)

TclTile2[file_,X_]:=(
L=Length[X];
i=2;
Do[{EdgeWrite[1,file,X[[i]],X[[i+1]]];i=i+1},{i,2,L-1}];
EdgeWrite[1,file,X[[2]],X[[L]]];
L=Length[X];
EdgeWrite[2,file,X[[2]],X[[(L-1)/2+2]]];
)






(*Here are figures 5.3,5.4,5.5 of the paper.
To draw them, uncomment, run the file, then
use the tcl program plot.t to see them.

TclTile1[TileA[0]]
TclTile1[TileB[0]]
TclTile1[TileA[1]]
*)


(*k is the number of layers of the tiling*)
TilingPix[k_]:=(
OpenWrite["out_to_tcl"];
i=1;Do[{TclTile2["out_to_tcl",TileA[i]];i=i+1},{i,1,2*k}];
i=1;Do[{TclTile2["out_to_tcl",TileB[2*i]];i=i+1},{i,1,k}];
Close["out_to_tcl"];
)


(* Here is the picture of the whole tiling, Figure 5.6:
TilingPix[35]
*)
