• fullscreen
  • Element.pde
  • sketch_aug03a_circle.pde
  • class Person
      int age;//age of person responded, radius of arc
      int response;//answer to yes/no question, color
      int enviro;//urban density, thickness
      int genre;//favorite type of movie, quadrant
      //String name;
      float xpos;
      float ypos;
      Person(int a, int r, int e, int g)
        this.xpos = width/2; //centered on sketch
        this.ypos = height/2;
        this.age= a; 
        this.response= r;
        this.enviro = e;
        this.genre = g;
      /*A display method. Visualizes each person as an ellipse. Age controlls the size. */
      void display() 
        stroke(255*response, 0, 0,100);
        strokeWeight(int(enviro*10));//urban density variable
        float disperse = random(-20,20);
        arc(width/2, height/2, 120*age+disperse, 120*age+disperse,(PI/4)*genre, ((PI/4)*genre)+(PI/4));
    int numPeople = 32;
    PFont h;
    //These arrays will store the age, name and response data from 3 txt files (in the data folder)
    String[] ages;
    String[] responses;
    String[] enviros;
    String[] genres;
    Person[] people = new Person[numPeople];
    void setup()
      size(800, 800); 
      h = loadFont("Helvetica-10.vlw");
      //I moved this to a function to "clean up" the setup a bit. Makes it easier to read...
    void draw()
      //A loop to display and update all Person objects.
      for (int i=0; i<numPeople; i++)
        //Display and check against mouse. This only needs to happen once for every Person. 
      fill(0, 150);
      //text("hover over arc to see response", 40, 40);
      text("<17", width/2, height/2+80);
      text("25", width/2, height/2+140);
      text("35", width/2, height/2+200);
      text("50", width/2, height/2+270);
      text("65<", width/2, height/2+330);
    void initializePeople()
      //Use loadStrings to load each text file into an array. Cast each array to the appropriate data type too.
      ages = loadStrings("age32.txt");
      responses = loadStrings("response32.txt");
      enviros = loadStrings("enviro32.txt");
      genres = loadStrings("genre32.txt");
       names[n], ages[n] and answers[n] correspond with one person's data, soooo we'll pass those three values
       into a Person object, which will keep track of them, and keep them together. Each person object now
       represents one of our interviewees. We could then visualize a person as a bar, ellipse, point, scaled svg... 
       Whatever you imagine doing with people's data, you can now do!
      for (int i=0; i<numPeople; i++)
        //Construct a new person (32 times). Pass in each row of data from the lists. 
        people[i] = new Person( int(ages[i]), int(responses[i]), int(enviros[i]), int(genres[i]));


    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.



    Ferenc Tobak 4

    Can computers be more creative than Humans?

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    Data Visualisation sketch showing responses from 32 people, with red bars representing people who think computers can be more creative than humans.

    Distance from center shows age of respondent
    strokeweight represents urban density (urban, suburban, rural)
    quadrant location represents favorite movie genre

    You need to login/register to comment.