• fullscreen
• vortex.pde
• ```//Vortex//Alejandro González//60rpm.tv/i//Pubic Domain/////////////////////////////////////////
//Just playing with some particles and convolution (the latter based on dotlassie´s fast blur//
//algorithm (credits below)////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

int h=450,w=900,s=w-1,M=-1;  //some constant values here
P[] p = new P[1000];         //1000 particles

////////////////////////////////////////////////////////////////////////////////////////////

void setup(){
size(w,h,P2D); background(0); stroke(M);
for(int i=0;i<p.length;i++) p[i]=new P();
}

void draw(){
for(int i=0;i<p.length;i++) {p[i].update(a); p[i].display();}
}

////////////////////////////////////////////////////////////////Some basic interaction here

//Restart
void keyPressed(){setup();}

///////////////////////////////////////////////////////////////////////////////////////////
//Particle class with motion provoked by attractors connected with some magnetism to the particles
//Particles wanders around the 'gravity center' of the poles. That will be our vortex.

class P {
float d,k,m,h; PVector l,s,a;

P(){
l= new PVector(random(width),random(height)); //random location
a=new PVector(); s=new PVector();             //acceleration, speed
h=random(1);
m=.01;                                        //magnetic force
}

//Some magnetic attraction -- inverse to distance, proportional to the magnetic force
if (A!=null){
for(PVector v:A)
if((d=PVector.dist(l,v))>0){
a=PVector.sub(v,l);
a.mult(m/d);
}
}

void display(){
point(l.x,l.y);
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Studying Dotlassie's fast blur //http://www.openprocessing.org/visuals/?visualID=5383,/////////////////////
//I realized more than a blur effect it's some kind of clever convolution generic tool with a constant mask//
//value, as useful to make a blur as to get different effects////////////////////////////////////////////////
//Thus experimenting I came into this sketch... ^-^////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

int[] p=pixels;
for(int y=1;y<h-1;y++){
int yw1=y*w+1, yws=y*w+s;
for(int i=yw1;i<yws;i++) {
//Apply AND to a reduced convolution kernel of four pixels(+) and get the average value (>>2=/4)
p[i]=((p[i-w]&m)+(p[i+w]&m)+(p[i-1]&m)+(p[i+1]&m))>>2;
}
}
updatePixels();
}
```

### tweaks (0)

This sketch is running as Java applet, exported from Processing.

## spatialVortex

16

Just messing around with some particles guided by attractors and convolution. The latter one is based on dotlassie´s fast blur:
http://www.openprocessing.org/visuals/?visualID=5383
Click to create an attractor (they´ll define the shape of the vortex).
Press any key to reset.

Eduardo Obieta
22 Mar 2012
wow Ö
that looks real awesome
Ale
7 Jul 2012
;-)
Nathan Riggs
3 Sep 2012
I can't help but notice how similar the results are (visually) to something I've done, though it looks like we've approached it in very different ways. Strange.

http://www.openprocessing.org/sketch/67676
Ale
23 Sep 2012
Hi Nathan, may be it's not so strange. We both have used a 'visual encoding' based on convolution algorithms and these ones tend to create that complex fancy patterns.
Btw, nice sketch. I love the zoom, well thought. It's quite interesting to check that pixel bunches magnificated.
Regards!
You need to login/register to comment.