// information. reading simple relationships. // letters will read from Moby Dick and grow every time they see themselves until they reach a certain size that fits the canvas. // this is a visual evidence of the fact that "e" is the most commonly used letter in english. // and i guess "x" or "z" would be the least. // or Herman Melville loved the "e"? int selector = -1; //int num = 3; //carambola int piso, techo, pizq, pdere; String alfabeto = "abcdefghijklmnopqrstuvwxyz"; String alfabetote = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int num = alfabeto.length(); int lector = 0; char letra; boolean muchoRadio= true; PFont font; byte book[]; float gravedad = 0.8; //float gravedad = 0.0; // mesa de billar float elasticidad = 0.95; //.95 float friccion = 0.75; //.75 Pelota[] pelotas = new Pelota[num]; void setup() { size(400,400); background(255,20,30); framerate(24); font = loadFont("Monaco-12.vlw"); smooth(); book = loadBytes("mobyDick.txt"); // book.length = 1221069 piso = height; //techo = height - 15*height/16; techo = 0; pdere = width; pizq = 0; letra = char(book[lector]); //noStroke(); for ( int i=0; i 950) {muchoRadio = false;} else println("lector is in: "+lector+" and sumradios is: " +sumRadios); sumRadios=0; } void mousePressed(){ for ( int i=0; i= 0 ){ pelotas[selector].x = mouseX; pelotas[selector].y = mouseY; pelotas[selector].vely = mouseY-pmouseY; pelotas[selector].velx = mouseX-pmouseX; } } void agitar(){ for ( int i=0; i= width/8) vely += gravedad; } void rebote(){ if ( y + vely + radio > piso ){ // el piso la orilla es igual a width y = piso - radio; velx *= friccion; vely *= -elasticidad; } if ( y + vely - radio < techo ){ // el techo en la orilla es igual a cero y = techo + radio; velx *= friccion; vely *= -elasticidad; } if ( x + velx + radio > width ){ x = width - radio; velx *= -elasticidad; vely *= friccion; } if ( x + velx - radio < 0 ){ x = radio; velx *= -elasticidad; vely *= friccion; } } void choque(){ for ( int i=0; i 0 ){ float dD = radio + R - d; float theta = atan2(deltay,deltax); velx += -dD*cos(theta)*M/(masa+M); vely += -dD*sin(theta)*M/(masa+M); velx *= elasticidad; vely *= elasticidad; } } } void desplazamiento(){ x += velx; y += vely; } void display(){ //float c =random(0,1); smooth(); stroke(0); if (c<0.45f) fill(0,0,255); else if (c>=0.45f) fill(255,255,255); //ellipse(x,y,2*radio,2*radio); if (c<0.45f) fill(255); else if (c>=0.45f) fill(0); textFont(font, radio*2); // good for alone text(letra, x-radio/2, y+radio/2); // good for alone //textFont(font, radio*1.2); // good for in ellipse //text(letra, x-radio/3, y+radio/2.5); // good for in ellipse } }