You are currently reviewing an older revision of this page.
function (Point ptGd) { /* this is quite a complicated script it draws shapes based on an indirection array, and has conditional left and right and up and down shifts depending on the position of the shape in the grid */ breakpoint; int bays = ptGd[0].Count; int floors = ptGd.Count;
Polygon pol = {}; //the output polygons int hexi = 0; //counter of the hozizontal direction int hexj = 0; //counter of the vertical direction int col = 0; //what collumn are we in? int shift = 0; //changes depending on out position for (int i = 0; i < floors-3; i=i+2)//floors -3 because it's referign to the bottom point { if (col%2!=0) //if in an even col { shift = 1; } else { shift = 0; } pol[hexi] = {}; for (int j = 0; j < bays-1; j+=2) { int arround = (j + shift);//%bays; //the mod(%) makes the seam join up; int allong = i; int currentColour = Random(1,14); pol[hexi][hexj] = {}; pol[hexi][hexj][0] = new Polygon(); pol[hexi][hexj][0].ByVertices({ ptGd[allong+2][(arround+1)%bays], ptGd[allong+3][(arround+1)%bays], ptGd[allong+2][(arround+2)%bays], }); pol[hexi][hexj][1] = new Polygon(); pol[hexi][hexj][1].ByVertices({ ptGd[allong+1][(arround+1)%bays], ptGd[allong+1][(arround+0)%bays], ptGd[allong+2][(arround+0)%bays], ptGd[allong+2][(arround+1)%bays], }); pol[hexi][hexj][2] = new Polygon(); pol[hexi][hexj][2].ByVertices({ ptGd[allong+1][(arround+1)%bays], ptGd[allong+2][(arround+1)%bays], ptGd[allong+2][(arround+2)%bays], ptGd[allong+1][(arround+2)%bays], }); pol[hexi][hexj][3] = new Polygon(); pol[hexi][hexj][3].ByVertices({ ptGd[allong+2][(arround+1)%bays], ptGd[allong+3][(arround+1)%bays], ptGd[allong+2][(arround+0)%bays], }); pol[hexi][hexj][4] = new Polygon(); pol[hexi][hexj][4].ByVertices({ ptGd[allong+1][(arround+1)%bays], ptGd[allong+1][(arround+0)%bays], ptGd[allong+0][(arround+1)%bays], }); pol[hexi][hexj][5] = new Polygon(); pol[hexi][hexj][5].ByVertices({ ptGd[allong+1][(arround+2)%bays], ptGd[allong+1][(arround+1)%bays], ptGd[allong+0][(arround+1)%bays], }); hexj++; } hexi++; col++; } return pol; }