/** * La espiral de teodoro de Cirene * by alba g corral. * * * Created Ag. 2007 */ int ancho = 485; int alto = 485; // //int angulo = 45; int maxtriangles = 100; // numero de triangulos // Width of entire wave int posyini = alto /2; int posxini = ancho/2; int cateto_long= 20; float xx1,yy1,xx2,yy2,xx3,yy3,angulo,trans; void setup() { size(ancho,alto); frameRate(10); colorMode(RGB,255,255,255,100); smooth(); } void draw() { background(255); cirene(); } void cirene(){ translate(posxini, posyini); //triangulo 1 xx2 = 0; yy2 = 0; angulo = atan2(cateto_long,cateto_long); xx1 = cos(angulo)*sqrt(2)*cateto_long; yy1 = -sin(angulo)*sqrt(2)*cateto_long; xx3 =cateto_long; yy3 = 0; triangle(xx1, yy1, xx2, yy2, xx3, yy3); //cambiamos rotate(-angulo); //stroke(0,100); for(int i=2;i80) fill(255, random(150,255)); else if(random(100)>50) fill(random(150,255),random(100,150),0, trans); else fill(0,random(100,150),random(0,155), trans); xx1 = sqrt(i)*cateto_long; yy1 = -cateto_long; xx3 =sqrt(i)*cateto_long; yy3 = 0; triangle(xx1, yy1, xx2, yy2, xx3, yy3); //triangulo 3 angulo = atan2(-yy1,xx1); rotate(-angulo); } } void keyPressed() { // save frame println("Saving frame... "+frameCount); if(key=='s') saveFrame("randcomp-###.png"); }