hjcarlisle
YaBB Newbies
Offline
Posts: 7
Re: Size of ouput TIF file
Reply #8 - May 19th , 2007, 3:52pm
Hi, didn't expect a reply that fast! I have done as you say (code below - not very elegant!) but I now get the error: 'The variable coord1 may be accessed before having been definitely assigned a value' I know the logic is OK, because the correct pattern appears on he screen if I put all the code back into draw(). float [][] coord1; float [][] coord2; float [][] coord2a; float [][] coord3; float [][] coord3a; float [][] coord4; void setup() { size(1500,500, OPENGL); noStroke(); coord1 = new float [6000] [2]; coord2 = new float [6000] [2]; coord2a= new float [6000] [2]; coord3 = new float [6000] [2]; coord3a = new float [6000] [2]; coord4 = new float [6000] [2]; for(int i=0; i<6000; i++) { coord1[i][0] = random(0, width); coord1[i][1] = random(0, height); coord4[i][0] = coord1[i][0] + random(0, 30) + 10; coord4[i][1] = coord1[i][1]; coord2[i][0] = coord1[i][0] + ((coord4[i][0] - coord1[i][0] )/3); coord2[i][1] = (coord1[i][1] + 2 + random(0,3)); coord2a[i][0] = coord2[i][0]; coord2a[i][1] = coord1[i][1] -(coord2[i][1] - coord1[i][1]); coord3[i][0] =coord1[i][0] + ((coord4[i][0] - coord1[i][0]) * 2 / 3); coord3[i][1] = (coord1[i][1] + 4 + random(0,3)); coord3a[i][0] = coord3[i][0]; coord3a[i][1] = coord1[i][1] - (coord3[i][1] - coord1[i][1]); } tiler=new TileSaver(this); //noLoop(); } public void draw() { if(tiler==null) return; // Not initialized // call TileSaver.pre() to prepare frame and setup camera if it exists. //if (first==0) { tiler.pre(); background(150,113,68); float theta; float [][] coord1; float [][] coord2; float [][] coord2a; float [][] coord3; float [][] coord3a; float [][] coord4; for(int i=0; i<6000; i++) { float colr = random(60, 120); float colg = random(110, 225); float colb = random(35, 110); float angle = random (0, 180); theta = radians(angle); rotate(theta); bezier(coord1[i][0], coord1[i][1], coord2[i][0], coord2[i][1], coord3[i][0], coord3[i][1], coord4[i][0], coord4[i][1]); bezier(coord1[i][0], coord1[i][1], coord2a[i][0], coord2a[i][1], coord3a[i][0], coord3a[i][1], coord4[i][0], coord4[i][1]); fill(colr,colg,colb); stroke(colr,colg,colb); translate(0,0); rotate(-theta); tiler.post(); } }