I need to fill a lineair space and generate a continuously evolving series of abstract drawings. All this to fill up some leftover space at the office (to make it less boring). In particular a 30 cm (1ft) high space below the windows. This stretches along the windows and is quite long.
To avoid repetetivity, I chose to seed the algorithm with somewhat random data in the form of a series of pixels extracted along the image of the earth.
I work at a hi-tech internet innovation research institute but are in no way affiliated to Silicon Valley, we came up with the idea of connecting Ghent with a line to silicon valley, the result, is not that interesting to show, but it is a line, one pixel wide. It is however an interesting series of pixels, where neighbouring pixels are related.
but what to to with pixels.
It’s not an awful lot of data. A color, an RGB value(3 times 8 bits), a sequence number perhaps, maybe the relation to the neighbor? Does it within a certain threshold have the same amount of blue, green and red? Or does it represent a bump? As it comes from a terrain map, maybe it can represent an altitude. not sure yet.
But what I was looking for was more something that contains enough data to allow to generate specific images
You’re looking at it, just above this sentence. after parsing the pixel color data from it, half an alien is generated according to this procedure.
which is then mirrored and completed. Repeat this for every pixel and you get a lot of different aliens, first 25 of the above line, pictured below
[processing code]
/**
* aliens
*/PImage lijn;
int px = 0;
int pxmax = 5;
int offsetY = 0;
int alienSize = 160;void setup() {
frameRate(4);
size(pxmax*alienSize, pxmax*alienSize);
smooth();
background(0);
noStroke();
lijn = loadImage(“lijn.png”);}
void alien(color code, int px){
//println(red(code));
//int Rr = Integer
int offsetX = px – (pxmax*offsetY) ;fill(red(lijn.pixels[px]),green(lijn.pixels[px]),blue(lijn.pixels[px]));
rect((offsetX*alienSize),(offsetY*alienSize),alienSize, alienSize);
fill(0);String alienR = Integer.toBinaryString(parseInt(red(code)));
alienR = “0000000” + alienR;
alienR = alienR.substring(alienR.length()-8);
String alienG = Integer.toBinaryString(parseInt(green(code)));
alienG = “0000000” + alienG;
alienG = alienG.substring(alienG.length()-8);
String alienB = Integer.toBinaryString(parseInt(blue(code)));
alienB = “0000000” + alienB;
alienB = alienB.substring(alienB.length()-8);
//
//println(alienR);
for(int i=0;i<8;i++){
//println(alienR.charAt(i));
}for (int col = 0 ; col < 4; col++) {
for (int row = 0; row < 8; row++){
if(col == 1) {
String[] alienRArray = alienR.split(“”);
if(parseInt(alienRArray[row+1]) == 1) {
rect((col*20)+offsetX*alienSize, (row*20)+offsetY*alienSize, 20, 20);
rect(((7-col)*20)+offsetX*alienSize, (row*20)+offsetY*alienSize,20,20);
}
}
if(col == 2) {
String[] alienGArray = alienG.split(“”);
if(parseInt(alienGArray[row+1]) == 1) {
rect((col*20)+offsetX*alienSize, (row*20)+offsetY*alienSize, 20, 20);
rect(((7-col)*20)+offsetX*alienSize, (row*20)+offsetY*alienSize,20,20);
}
}
if(col == 3) {
String[] alienBArray = alienB.split(“”);
if(parseInt(alienBArray[row+1]) == 1) {
rect((col*20)+offsetX*alienSize, (row*20)+offsetY*alienSize, 20, 20);
rect(((7-col)*20)+offsetX*alienSize, (row*20)+offsetY*alienSize,20,20);
}
}
}
}
if(offsetX == 4){
offsetY++;
}
}
void draw(){
lijn.loadPixels();
color code = color(red(lijn.pixels[px]),green(lijn.pixels[px]),blue(lijn.pixels[px])) ;
alien(code, px);
px++;
}
[/processing code]