:/ Thanks everybody for all the help. Not. It's been nearly a month, I'm not quite done, but at least it isn't spazzing out anymore.
Prototype Code:PFont font;
String fontFile = "PTF-Nordic-48.vlw";
float baseline_ratio = 0.4;
float angle = 0;
float outwards = 1;
String[] tags = { "The Office", "The Colbert Report", "Battlestar Galactica", "weeds", "californication", "scrubs", "CSI", "Smallville", "House", "Family Guy", "Daily Show", "US", "Boondocks", "Venture Brothers", "Flight of the Conchords", "Firefly", "Angel", "Grey's Anatomy", "Venture Bros", "King of The Hill", "America's Next Top Model", "Project Runway", "My Name is Earl", "Dirty Jobs", "Eureka", "Friends", "Frasier", "Sex and the City", "Food Network", "South Park", "Seinfeld", "The Daily Show", "Colbert Report", "The Riches", "LOST", "Aqua Teen Hunger Force", "Arrested Development", "Freaks and Geeks", "MythBusters", "Dexter", "Six Feet Under", "Home Movies", "Pete & Pete", "Extras", "tears", "Law and Order", "Pete and Pete", "Invader Zim", "Jericho", "The Boondocks", "The Simpsons", "Futurama", "jeopardy", "King Of Queens", "American Dad", "Dr. Who", "That 70's Show", "Avatar", "Fraggle Rock", "History Channel", "24", "Kids in the Hall", "Strangers With Candy"};
int[] tagtally = { 16, 4, 3, 8, 2, 15, 5, 3, 8, 16, 3, 2, 2, 2, 5, 5, 2, 9, 2, 2, 4, 4, 3, 2, 2, 5, 2, 4, 2, 2, 3, 6, 7, 2, 9, 4, 7, 2, 2, 6, 3, 5, 2, 2, 2, 2, 3, 3, 2, 3, 5, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
int most = max(tagtally);
int least = min(tagtally);
int large_font = 28;
int small_font = 8;
Box[] boxes = new Box[tags.length];
void setup(){
size(420,210);
smooth();
rectMode(CENTER);
font = loadFont(fontFile);
for (int i = 0; i < tags.length; i++) {
int h_test = int(map(tagtally[i], least, most, small_font, large_font));
textFont(font, h_test);
int w_test = int(textWidth(tags[i]));
boxes[i] = new Box(tags[i],w_test,h_test);
}
}
void draw(){
background(0);
pushMatrix();
scale(0.82,0.82);
translate(0.12*width, 0.15*height);
for(int i=0; i<boxes.length; i++){
boxes[i].collide(i);
fill(0);
boxes[i].render(i);
}
popMatrix();
//check for stopping
int completed = 0;
for(int i=0; i<boxes.length; i++){
if(boxes[i].frozen)
completed++;
}
println("completed:" + completed);
if(completed == boxes.length){
noLoop();
}
}
void mouseReleased(){
boxes[0].x = random(20,380);
boxes[0].y = random(20,180);
}
Tag Class Code:class Box{
public float x, y, w, h, volume, attempts;
String word;
boolean frozen = true;
color c;
Box(String word, int w, int h){
this.word = word;
this.x = cos(angle) * log(outwards) * 42 + 210;
this.y = sin(angle) * log(outwards) * 21 + 105;
angle -= 61;
outwards += 0.4;
this.w = w;
this.h = h;
this.volume = w*h;
this.c = color(random(100,255), random(100,255), random(100,255));
}
void render(int id){
/* noFill();
stroke(0,20);
rect(x,y,w,h); */
fill(c);
textFont(font, h);
text(tags[id], int(x - w/2), int(y + h * baseline_ratio));
}
void collide(int i){
frozen = true;
for(i+=1; i<boxes.length; i++){
float dx = boxes[i].x - this.x;
float dy = boxes[i].y - this.y;
float tx = boxes[i].w/2 + this.w/2;
float ty = boxes[i].h/2 + this.h/2;
if( (abs(dx) < tx) && (abs(dy) < ty) ){
float me = 0.5 * boxes[i].volume / this.volume;
float you = 0.5 * this.volume / boxes[i].volume;
attempts++;
println("for collision "+i+", I am "+me+", & you are "+you);
frozen = false;
if(dx > 0){
this.x -= me * 1.5;
boxes[i].x += you * 1.5;
}else{
this.x += me * 1.5;
boxes[i].x -= you * 1.5;
}
if(dy > 0){
this.y -= me;
boxes[i].y += you;
}else{
this.y += me;
boxes[i].y -= you;
}
if(this.attempts > 500){
this.x = random(0,width);
this.y = random(0,height);
this.attempts = 0;
}
}
}
}
}
And
here's my font file.