We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
symmetry (Read 455 times)
symmetry
Mar 20th, 2007, 4:31pm
 
hi

i have a simple applet that divides the environment into squares and colours each of them randomly. I'd like to reflect the colours used in top half in the bottom. This is my code at the moment:

Code:
for (int i = 0; i<COLUMNS; ++i) 
{
for (int j = 0; j<ROWS; ++j)
{
p[j] = new Pixels(i * TILE_WIDTH, j * TILE_HEIGHT);
p[j].draw();
p[j].animate();
}
}


and the draw and animate functions are as follows:

Code:
  void draw()
{
//
rect(x, y, TILE_WIDTH, TILE_HEIGHT);
}
void animate()
{
int red_random = (int)random(255);
int green_random = (int)random(255);
int blue_random = (int)random(255);
fill(red_random, green_random, blue_random);
}


I've tried a few different methods, along the lines of width-x and height-y to duplicate, but I can't get anything to work. My goal is to have 4 fold symmetry, but I would be happy with x2 atm Smiley
Page Index Toggle Pages: 1