Using data to draw custom shapes

Thanks for your reply, @Chrisir ! Appreciate all this thorough information!

Here’s what I’ve got – a very rough start. As I don’t have much code background, don’t be too scared of my messiness! I’m having trouble knowing how to store x,y values in an array of PVector. Also, the items inside beginShape are incorrect - nothing is actually being drawn. Any suggestions?

Table myTable = loadTable("data-small.csv", "header");
int numEntries = myTable.getRowCount();
float time;
float radius;

size(400,400);
background(255);

for(int i = 0; i < numEntries; i++){
    time = myTable.getRow(i).getFloat("Time Decimal");
    println("time:", time);
    
    radius = myTable.getRow(i).getFloat("Productivity Level");
    println("radius:", radius);

    beginShape();
        float angle = map(time,0,24,0,TWO_PI);
        float xCenter = width/2; 
        float yCenter = height/2;
        float xCoord = xCenter + sin(angle) * radius;
        float yCoord = yCenter + cos(angle) * radius;
  
        curveVertex(xCoord, yCoord);
      endShape(CLOSE);
      }
1 Like