Revision: 51563
Updated Code
at September 28, 2011 13:30 by haruo666
Updated Code
import processing.opengl.*; void setup() { size(1100, 1100, OPENGL); background(0,30,60); PFont font; font = loadFont("SansSerif-48.vlw"); textFont(font); fill(255); translate(width/2, height/2); textAlign(RIGHT); textSize(10); String friends[] = loadStrings("friends"); //friend names sorted by id String connections[] = loadStrings("connections"); //comma separated friend ids float r = 420; stroke(255, 30); for (int j=0; j<connections.length; j++) { int[] node = int(split(connections[j], ',')); line(r*cos(PI + 2*PI/friends.length*(node[0]+0.5)), r*sin(PI + 2*PI/friends.length*(node[0]+0.5)), r*cos(PI + 2*PI/friends.length*(node[1]+0.5)), r*sin(PI + 2*PI/friends.length*(node[1]+0.5)) ); } for (int i=0; i<friends.length; i++) { //println(friends[i]); text(friends[i], -r-2, 0); rotate(2*PI/friends.length); } } void draw() { //nothing yet }
Revision: 51562
Updated Code
at September 28, 2011 13:28 by haruo666
Updated Code
import processing.opengl.*; void setup() { size(1100, 1100, OPENGL); background(0,30,60); PFont font; font = loadFont("SansSerif-48.vlw"); textFont(font); fill(255); translate(width/2, height/2); textAlign(RIGHT); textSize(10); String friends[] = loadStrings("friends"); //friend names sorted by id String connections[] = loadStrings("connections"); //comma separated friend ids float r = 420; stroke(255, 30); for (int j=0; j<connections.length; j++) { int[] node = int(split(connections[j], ',')); line(r*cos(PI + 2*PI/friends.length*(node[0]+0.5)), r*sin(PI + 2*PI/friends.length*(node[0]+0.5)), r*cos(PI + 2*PI/friends.length*(node[1]+0.5)), r*sin(PI + 2*PI/friends.length*(node[1]+0.5)) ); } for (int i=0; i<friends.length; i++) { //println(friends[i]); text(friends[i], -r-2, 0); rotate(2*PI/friends.length); } } void draw() { //nothing yet }
Revision: 51561
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 28, 2011 13:28 by haruo666
Initial Code
import processing.opengl.*; void setup() { size(1100, 1100, OPENGL); background(0,30,60); PFont font; font = loadFont("SansSerif-48.vlw"); textFont(font); fill(255); translate(width/2, height/2); textAlign(RIGHT); textSize(10); String friends[] = loadStrings("friends"); //friend names sorted by id String connections[] = loadStrings("connections"); //comma separated friend ids float r = 420; stroke(255, 30); for (int j=0; j<connections.length; j++) { int[] node = int(split(connections[j], ',')); line(r*cos(PI + 2*PI/friends.length*(node[0]+0.5)), r*sin(PI + 2*PI/friends.length*(node[0]+0.5)), r*cos(PI + 2*PI/friends.length*(node[1]+0.5)), r*sin(PI + 2*PI/friends.length*(node[1]+0.5)) ); } for (int i=0; i<friends.length; i++) { //println(friends[i]); text(friends[i], -r-2, 0); rotate(2*PI/friends.length); } } void draw() { //nothing yet }
Initial URL
Initial Description
Initial Title
FB social graph
Initial Tags
Initial Language
Java