Jose vasquez: recurcividad

De Casiopea


Títulolineas en fi
Tipo de ProyectoProyecto de Taller
Palabras Clavetarea 11
Período2012-2012
AsignaturaTaller Inicial 1ª y 2ª Etapa,
Del CursoImagen Escrita 2012,
CarrerasArquitectura
Alumno(s)José Ignacio Vásquez
ProfesorHerbert Spencer

//cuadrados que estan un una proporcion áurea //estos cuadrados tienen lineas en distintas direcciones

import processing.pdf.*; void setup() {

 size(1200, 742, PDF, "aureaprocessing.pdf");

}

void draw() {

 float i, j;
 int direction = 0;  
 float cornerX = 0;
 float cornerY = 0;
 float phi =  (1+sqrt(5))/2;//se establece fi
 float s = width / (1.62);
 int weight = 6;
 for (i = 0; i < 12; i++) {
   if (weight > 2) {
     weight--;
   }
   rect(cornerX, cornerY, s, s);
   if (direction % 2 == 0) {
     for (j = cornerX; j <= cornerX + s; j += 10) {
       line(j, cornerY, j, cornerY + s);
     }
   } 
   else {
     for (j = cornerY; j <= cornerY + s; j += 10) {
       line(cornerX, j, cornerX + s, j);
     }
   }
   if (direction % 4 == 0) {
     cornerX = cornerX + s;
   }
   else if (direction % 4 == 1) {
     cornerY = cornerY + s;
     cornerX = cornerX + (s - s / phi);
   }
   else if (direction % 4 == 2) {
     cornerX = cornerX - (s / phi);
     cornerY = cornerY + (s - s / phi);
   }
   else if (direction % 4 == 3) {
     cornerY = cornerY - (s / phi);
   }
   direction++;
   s = s / phi;
 }
println("---> PDF OK");
  exit();

}