Hey guys and girls.
Could someone please help me with a project I am trying to complete. A really nice person over in the Reddit forums helped me get this far but I am stuck at the moment.
I have an assignment for my Biology unit where I need to display some data we collected from the class as a pretty picture in Processing basically. I was thinking of using data that shows average steps per minute people in our class took on a line and have the width of the line become thicker when the class took more steps and thinner when they took less steps. I then wanted to do the same for each of the 7 days of the week and then combine the 7 lines to form a heptagon.
This is an image of what I am trying to achieve. https://i.imgur.com/dOhuZSU.jpg
At the moment I have the first line in the canvas displayed as I would like it. When I add the second line though, I am unable to work out how to get it on the angle I want to start making the heptagon.
Thanks to anyone willing to respond, I really appreciate anyone who gives some of their time to offer some advice.
This is the code so far, as I said mostly thanks to the help of a friendly Reddit poster.
Table table;
void setup() {
size(800, 600);
background(255);
table = loadTable("steps.csv", "header");
strokeWeight(2);
}
void draw() {
background(255);
//Move origin down by height/2
translate(200, height/1.2);
// Test possible scaling values
float scalex = map(2, 0, width, 0, 100);
float scaley = map(2, 0, height, 0, 100);
//Male curve
beginShape();
for (int i = 0; i<table.getRowCount(); i++) {
TableRow row = table.getRow(i);
float x = row.getInt("minute");
float yf = row.getFloat("fmsteps");
float ym = row.getFloat("msteps");
println(x, yf, ym);
stroke(0,0,255);
curveVertex(x*scalex, ym*scaley);
}
endShape();
//Female curve
beginShape();
for (int i = 0; i<table.getRowCount(); i++) {
TableRow row = table.getRow(i);
float x = row.getInt("minute");
float yf = row.getFloat("fmsteps");
float ym = row.getFloat("msteps");
println(x, yf, ym);
stroke(255,0,255);
curveVertex(x*scalex, -yf*scaley);
}
endShape();
//Male curve2
beginShape();
for (int i = 0; i<table.getRowCount(); i++) {
TableRow row = table.getRow(i);
float x = row.getInt("minute");
float yf = row.getFloat("fmsteps2");
float ym = row.getFloat("msteps2");
println(x, yf, ym);
stroke(0,0,255);
curveVertex(x*scalex, ym*scaley);
}
endShape();
//Female curve2
beginShape();
for (int i = 0; i<table.getRowCount(); i++) {
TableRow row = table.getRow(i);
float x = row.getInt("minute");
float yf = row.getFloat("fmsteps2");
float ym = row.getFloat("msteps2");
println(x, yf, ym);
stroke(255,0,255);
curveVertex(x*scalex, -yf*scaley);
}
endShape();
}