arrows fixed + colors

This commit is contained in:
DarianTr
2023-11-17 19:50:30 +01:00
parent d5d9994f18
commit a32425724c
3 changed files with 29 additions and 20 deletions

View File

@@ -24,20 +24,22 @@ class Graph {
void draw_points(int point_weight) {
strokeWeight(point_weight);
stroke(#FF0000);
stroke(255);
for (int i = 0; i < coords.size(); i++) {
point(coords.get(i).get(0), coords.get(i).get(1));
text(i+1, coords.get(i).get(0)-3, coords.get(i).get(1)+5);
textAlign(CENTER, CENTER);
fill(0);
text(i+1, coords.get(i).get(0), coords.get(i).get(1));
}
}
void draw_graph(int graph_weight, int point_weight) {
stroke(#550000);
strokeWeight(10);
stroke(255);
strokeWeight(graph_weight);
for (int i = 0; i < adj.size(); i++) {
for (int idx = 0; idx < adj.get(i).size(); idx++) {
int e = adj.get(i).get(idx);
draw_arrow(coords.get(i).get(0), coords.get(i).get(1), coords.get(e).get(0), coords.get(e).get(1), point_weight, graph_weight);
draw_arrow(coords.get(i).get(0), coords.get(i).get(1), coords.get(e).get(0), coords.get(e).get(1), point_weight, graph_weight, 15);
}
}
}