diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-12-28 17:33:35 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-12-28 17:33:35 -0500 |
commit | 9e1610143f0e96b77ca962a7113d79a2fbcbf6f5 (patch) | |
tree | 17d5f699769c9eb7cec602c19b68438e6e6cec14 /src/animate.cpp | |
parent | a20ac5471a35c9c2a70b48fc4393d2323b52bd85 (diff) | |
download | fuse_networks-9e1610143f0e96b77ca962a7113d79a2fbcbf6f5.tar.gz fuse_networks-9e1610143f0e96b77ca962a7113d79a2fbcbf6f5.tar.bz2 fuse_networks-9e1610143f0e96b77ca962a7113d79a2fbcbf6f5.zip |
partially fixed problems that arise in small systems by reworking the way that boundary edges are identified
Diffstat (limited to 'src/animate.cpp')
-rw-r--r-- | src/animate.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/animate.cpp b/src/animate.cpp index 26f4996..a24f0f2 100644 --- a/src/animate.cpp +++ b/src/animate.cpp @@ -25,15 +25,15 @@ void animate::pre_fracture(const network &n) { 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 (fabs(r1.x - r2.x) > n.G.L.x / 2) { - if (r1.x < n.G.L.x / 2) { + if (n.G.edges[i].crossings[0]) { + if (r1.x < r2.x) { r1.x += n.G.L.x; } else { r2.x += n.G.L.x; } } - if (fabs(r1.y - r2.y) > n.G.L.y / 2) { - if (r1.y < n.G.L.y / 2) { + if (n.G.edges[i].crossings[1]) { + if (r1.y < r2.y) { r1.y += n.G.L.y; } else { r2.y += n.G.L.y; @@ -63,16 +63,16 @@ void animate::bond_broken(const network& n, const current_info& cur, unsigned in 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 (fabs(r1.x - r2.x) > n.G.L.x / 2) { - if (r1.x < n.G.L.x / 2) { - r2.x -= n.G.L.x; + if (n.G.edges[i].crossings[0]) { + if (r1.x < r2.x) { + r1.x += n.G.L.x; } else { r2.x += n.G.L.x; } } - if (fabs(r1.y - r2.y) > n.G.L.y / 2) { - if (r1.y < n.G.L.y / 2) { - r2.y -= n.G.L.y; + if (n.G.edges[i].crossings[1]) { + if (r1.y < r2.y) { + r1.y += n.G.L.y; } else { r2.y += n.G.L.y; } @@ -111,20 +111,20 @@ void animate::post_fracture(network &n) { 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 (fabs(r1.x - r2.x) > n.G.L.x / 2) { - if (r1.x < n.G.L.x / 2) { - r1.x += n.G.L.x; - } else { - r2.x += n.G.L.x; - } - } - if (fabs(r1.y - r2.y) > n.G.L.y / 2) { - if (r1.y < n.G.L.y / 2) { - r1.y += n.G.L.y; - } else { - r2.y += n.G.L.y; - } - } + if (n.G.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 (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); |