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.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › 3d network, force directed layout
Page Index Toggle Pages: 1
3d network, force directed layout (Read 551 times)
3d network, force directed layout
Sep 11th, 2008, 4:16pm
 
Hi

Im wondering if anyone knows of any 3d network graph sketches for processing that use a force directed layout algorithm to position nodes...I have seen it in 2d and could really use the third dimension....

thanks
Re: 3d network, force directed layout
Reply #1 - Sep 11th, 2008, 7:19pm
 
well I sort of hacked an existing graph to make it 3d. it seemed to work for the most part - this is the first time I have done anything in 3d. I just took any lines that were calculating co-ordinates in the x and y direction and tacked on a z. There were a couple places where I had no idea what to do, and this is why I'm writing...

1. for the following, how do you specify "depth"?
 void update () {
   if (!fixed) {
     x += constrain(dx, -5, 5);
     y += constrain(dy, -5, 5);
     z += constrain(dz, -5, 5);

     x= constrain(x,0,width);
     y= constrain(y, 0, height);
     z= constrain(z, 0, height);
   }
   dx /=2;
   dy /=2;
   dz /=2;
 }

2. Again, I think I need a "depth":

Node(String common) {
   this.common = common;
   x = random(width);
   y = random(height);
   z = 0;
 }

3. There doesnt seem to be a built-in mouseZ:

void mouseDragged() {
 if (selection !=null) {
   selection.x = mouseX;
   selection.y = mouseY;
 }
}

any ideas?
Page Index Toggle Pages: 1