diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-11-01 12:33:37 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2018-11-01 12:33:37 -0400 |
commit | 07906baa42470bad14d2c40f57967691f6118969 (patch) | |
tree | 416ae624829967861c7c799103b3ff795e9e36b4 /lib/geometry.c | |
parent | 8c4c42d81745ea33c31150fe22e834d97e29ede6 (diff) | |
download | fuse_networks-07906baa42470bad14d2c40f57967691f6118969.tar.gz fuse_networks-07906baa42470bad14d2c40f57967691f6118969.tar.bz2 fuse_networks-07906baa42470bad14d2c40f57967691f6118969.zip |
revamped and simplied fracture code with c++
Diffstat (limited to 'lib/geometry.c')
-rw-r--r-- | lib/geometry.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/lib/geometry.c b/lib/geometry.c deleted file mode 100644 index 2c1987b..0000000 --- a/lib/geometry.c +++ /dev/null @@ -1,55 +0,0 @@ - -#include "fracture.h" - -int edge_to_verts(unsigned int width, bool periodic, unsigned int edge, - bool index) { - assert(edge < pow(width, 2)); - - int x = edge / width + 1; - int y = edge % width + 1; - - if (periodic) { - return (((index ^ (x % 2)) + 2 * ((y + (index ^ (!(x % 2)))) / 2) - 1) % - width + - (x - index) * width) / - 2; - } else { - return ((index ^ (x % 2)) + 2 * ((y + (index ^ (!(x % 2)))) / 2) + - (x - index) * (width + 1) - 1) / - 2; - } -} - -int dual_edge_to_verts(unsigned int width, bool periodic, unsigned int edge, - bool index) { - assert(edge < pow(width, 2)); - - int x = edge / width + 1; - int y = edge % width + 1; - - if (periodic) { - return (((index ^ (!(x % 2))) + 2 * ((y + (index ^ (x % 2))) / 2) - 1) % - width + - (x - index) * width) / - 2; - } else { - return ((index ^ (!(x % 2))) + 2 * ((y + (index ^ (x % 2))) / 2) + - (x - index) * (width + 1) - 1) / - 2; - } -} - -double dual_vert_to_coord(unsigned int width, bool periodic, unsigned int vert, - bool index) { - if (periodic) { - if (index) - return (2 * vert) % width + (2 * vert / width) % 2; - else - return 2 * vert / width; - } else { - if (index) - return (2 * vert) % (width + 1); - else - return (2 * vert) / (width + 1); - } -} |