## Dualization method for ten-fold rotational symmetry – the code

```//  this is for the main tab
//  generates 2n-fold rotational symmetry
//  can be broken to get n-fold rotational symmetry

float unitLength;
float xRange,yRange;     // visible coordinates from -(xy)Range to +(xy)Range
float sqrt2=sqrt(2.),sqrt05=sqrt(0.5),rt3=sqrt(3.);
float small,lineLenghtSquare;
Grid grid,gridTwo;

void setup(){
size(600,600);
smooth();
unitLength=20;
setupCoordinates();
ellipseMode(CENTER);
small=0.001;
grid=new Grid();
gridTwo=new Grid();
}

void draw(){
noLoop();
doTransformations();   // attention: translate and scale are reset at start of draw
background(255);
int n=5;                  // for tilings with 2*n fold symmetry
float plusMinus=0.;       // for breaking the symmetry,
float xTrans,yTrans,angle,s;
xTrans=05;                      //translation of the dual
yTrans=05;                      //.........................
for(int i=0;i<n;i++){
angle=PI*i/n;
s=plusMinus+xTrans*cos(angle)+yTrans*sin(angle);
s=s-floor(s);
plusMinus=-plusMinus;
parallels(gridTwo,s,angle);
grid=combination(grid,gridTwo);
emptyGrid(gridTwo);
}
stroke(color(0,0,100));
trueStrokeWeight(1.5);
grid.makeDual();
grid.dualPoints.mult(0.45); //adjust image to screen
grid.dualPoints.translation(new Vector(0,0));
int nRhombs=n/2;
for (int i=1;i<=nRhombs;i++){
fill(255*i/nRhombs);
grid.dualPolygons.showRhomb(PI*i/n);
}
grid.dualLines.show();
//  saveImage();
}
//----------------------------------------------------------
//  routine to delete a grid, I hope that garbage collection is not critical

void emptyGrid(Grid grid){
grid.gridLines.lines=new Line[0];
grid.gridPoints.points=new Point[0];
}

//----------------------------------------------------------
//
//  parallel lines, to fill the entire regiion
//
//  offset=0 for perfect symmetry around x,y=0

void parallels(Grid grid, float offset,float angle) {
grid.setTranslation(offset+0.5,0.);
grid.setRotation(angle);
int yR=int(2*yRange);
int xR=int(2*xRange);
for (int i=-xR;i<xR;i++){