From 948f90b6493da83d10e18f30b0fbb8e937e29c0b Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 24 Jun 2019 21:41:34 -0400 Subject: mostly implemented the ability to find dead bonds using topological properties --- src/animate.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 6 deletions(-) (limited to 'src/animate.cpp') diff --git a/src/animate.cpp b/src/animate.cpp index 9ba335b..532bd70 100644 --- a/src/animate.cpp +++ b/src/animate.cpp @@ -19,9 +19,10 @@ void animate::pre_fracture(const network &n) { boost::remove_edge_if(trivial, G); glClearColor(1.0f, 1.0f, 1.0f, 1.0f ); + glLineWidth(5); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINES); - glColor3f(0.0f, 0.0f, 0.0f); + glColor3f(0.9f, 0.9f, 0.9f); for (unsigned i = 0; i < n.G.edges.size(); i++) { graph::coordinate r1 = n.G.vertices[n.G.edges[i].v[0]].r; graph::coordinate r2 = n.G.vertices[n.G.edges[i].v[1]].r; @@ -59,19 +60,62 @@ void animate::bond_broken(const network& n, const current_info& cur, unsigned i) boost::add_edge(n.G.dual_edges[i].v[0], n.G.dual_edges[i].v[1], {i}, G); + glClearColor(1.0f, 1.0f, 1.0f, 1.0f ); + glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINES); // Each set of 3 vertices form a triangle - glColor3f(1.0f, 1.0f, 1.0f); // Blue - graph::coordinate r1 = n.G.vertices[n.G.edges[i].v[0]].r; - graph::coordinate r2 = n.G.vertices[n.G.edges[i].v[1]].r; - if (n.G.edges[i].crossings[0]) { + /* + glColor3f(0.0f, 0.0f, 0.0f); // Blue + graph::coordinate r1 = n.G.dual_vertices[n.G.dual_edges[i].v[0]].r; + graph::coordinate r2 = n.G.dual_vertices[n.G.dual_edges[i].v[1]].r; + + if (n.G.dual_edges[i].crossings[0]) { if (r1.x < r2.x) { r1.x += n.G.L.x; } else { r2.x += n.G.L.x; } } - if (n.G.edges[i].crossings[1]) { + if (n.G.dual_edges[i].crossings[1]) { + if (r1.y < r2.y) { + r1.y += n.G.L.y; + } else { + r2.y += n.G.L.y; + } + } + + glVertex2d(r1.x, r1.y); + glVertex2d(r2.x, r2.y); + */ + + bool weird = false; + + for (unsigned j = 0; j < n.G.edges.size(); j++) { + bool draw = false; + if (cur.currents[j] < 1e-9 && !n.backbone[j]) { + glColor3f(1.0f, 0.0f, 0.0f); // Blue + weird = true; + draw = true; + } else if (n.backbone[j] && !n.fuses[j] && j != i) { + glColor3f(0.8f, 0.8f, 0.8f); // Blue + draw = true; + } else if (!n.fuses[j]) { + glColor3f(0.0f, 0.0f, 0.0f); // Blue + draw = true; + } + + if (draw) { + graph::coordinate r1 = n.G.vertices[n.G.edges[j].v[0]].r; + graph::coordinate r2 = n.G.vertices[n.G.edges[j].v[1]].r; + + if (n.G.edges[j].crossings[0]) { + if (r1.x < r2.x) { + r1.x += n.G.L.x; + } else { + r2.x += n.G.L.x; + } + } + if (n.G.edges[j].crossings[1]) { if (r1.y < r2.y) { r1.y += n.G.L.y; } else { @@ -81,12 +125,17 @@ void animate::bond_broken(const network& n, const current_info& cur, unsigned i) glVertex2d(r1.x, r1.y); glVertex2d(r2.x, r2.y); + } + + } glEnd(); glFlush(); + if (weird) {std::cout << "\n"; getchar();} } void animate::post_fracture(network &n) { + /* std::list crack; // unsigned crack_component = component[n.G.dual_edges[crack.front()].v[0]]; unsigned crack_component = 10000; @@ -223,5 +272,6 @@ void animate::post_fracture(network &n) { glFlush(); } } +*/ } -- cgit v1.2.3-70-g09d2