Trama y distancia

De Casiopea
Trama y distancia



TítuloTrama y distancia
Tipo de ProyectoProyecto de Curso
AsignaturaTaller Inicial Común 1ª y 2ª Etapa,
Del CursoImagen Escrita,
CarrerasDiseño Gráfico"Diseño Gráfico" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property., Diseño Industrial"Diseño Industrial" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property.
Alumno(s)Cindy Sanhueza
ProfesorHerbert Spencer

float mx, my, nx, ny; float[][] coords; void setup() {

 size(800, 500); 
 mx = 50; 
 my = 50; 
 nx = 14; 
 ny = 12; 


 coords = new float[(int)(nx*ny)][2];
 float spx, spy, px, py;


 spx = (width - (2 * mx))  / (nx-1);
 spy = (height - (2 * my)) / (ny-1);


 for (int y = 0; y < ny; y++) {
   for (int x = 0; x < nx; x++) {
     coords[(int)((ny*y)+x)][0] = mx + (x * spx);
     coords[(int)((ny*y)+x)][1] = my + (y * spy);
   }
 }
 smooth();
 background(255);

}

void draw() {

 for (int i = 0; i < nx*ny; i++) {
   for (int j = 0; j < i; j++) {
     float d = dist(coords[i][0], coords[i][1], coords[j][0], coords[j][1]); 
     if (d < 50) {
       stroke(#255186);
       line(coords[i][0], coords[i][1], coords[j][0], coords[j][1]);
     }
   }


   coords[i][0] += random(-3, 3);
   coords[i][1] += random(-3, 3);


   ellipse(coords[i][0], coords[i][1], 7, 8);
 }
 noStroke();
 fill(255, 15);
 rect(0, 0, width, height);

}