Somehow I ended up reading Uber’s articles on H3, a library they wrote to divide up their markets into hexagons. They have a github page : [https://github.com/uber/h3/blob/master/KML/icosa.kml#L204]
that uses kml to draw an icosahedron. I put all the coordinates into a csv file and then read those coordinates to try to draw the shape. What I got is strange and I dont understand why it looks so goofy.
Here’s the code:
Bubble[] bubbles;
Bubble[] bubbles2;
Table table;
public void setup() {
size(1275, 750, P3D);
orientation(LANDSCAPE);
}
public void draw() {
background(0);
loadData();
}
void loadData() {
// Load CSV file into a Table object
// "header" option indicates the file has a header row
table = loadTable("dymax.csv", "header");
// The size of the array of Bubble objects is determined by the total number of rows in the CSV
bubbles = new Bubble[table.getRowCount()];
// You can access iterate over all the rows in a table
int rowCount = 0;
beginShape();
for (TableRow row : table.rows()) {
// You can access the fields via their column name (or index)
float x = row.getFloat("x");
float y = row.getFloat("y");
x = map(radians(x), radians(-180),radians(180),width, width - width);
y = map(radians(y),radians(-90),(radians(90)),height,height - height);
// Make a Bubble object out of the data read
bubbles[rowCount] = new Bubble(x, y);
for (int i=0; i < rowCount; i ++){
println(rowCount, x, y);
stroke(255,0,0);
strokeWeight(2);
noFill();
curveVertex(x,y);
curveVertex(x,y);
}
rowCount++;
}
endShape();
}
// A Bubble class
class Bubble {
float x,y,z;
//float diameter;
// String name;
boolean over = false;
// Create the Bubble
Bubble(float x_, float y_){ //, float diameter_, String s) {
x = x_;
y = y_;
// diameter = diameter_;
// name = s;
}
// CHecking if mouse is over the Bubble
// Display the Bubble
void display() {
}
}
type or paste code here