diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-02-10 12:18:11 -0500 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2017-02-10 12:18:11 -0500 |
commit | 901b9f16494f37890be17ef4bb66e6efc6873340 (patch) | |
tree | 03e5f1769cbdb89eb1b4c45c16dc7d867184efaf /src/fortune/voronoi.c | |
parent | 1e1fdfc2e3892667bccaf317a01defd8832041c7 (diff) | |
download | fuse_networks-901b9f16494f37890be17ef4bb66e6efc6873340.tar.gz fuse_networks-901b9f16494f37890be17ef4bb66e6efc6873340.tar.bz2 fuse_networks-901b9f16494f37890be17ef4bb66e6efc6873340.zip |
changed code to rely on jst
Diffstat (limited to 'src/fortune/voronoi.c')
-rw-r--r-- | src/fortune/voronoi.c | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/fortune/voronoi.c b/src/fortune/voronoi.c deleted file mode 100644 index dc9945f..0000000 --- a/src/fortune/voronoi.c +++ /dev/null @@ -1,103 +0,0 @@ -# -#include "defs.h" - -struct Site *sites; -int nsites; -int siteidx; -int sqrt_nsites; -int nvertices; -struct Freelist sfl; -struct Site *bottomsite; - -/* implicit parameters: nsites, sqrt_nsites, xmin, xmax, ymin, ymax, - deltax, deltay (can all be estimates). - Performance suffers if they are wrong; better to make nsites, - deltax, and deltay too big than too small. (?) */ - -void voronoi(triangulate, nextsite) int triangulate; -struct Site *(*nextsite)(); -{ - struct Site *newsite, *bot, *top, *temp, *p; - struct Site *v; - struct Point newintstar; - int pm; - struct Halfedge *lbnd, *rbnd, *llbnd, *rrbnd, *bisector; - struct Edge *e; - - PQinitialize(); - bottomsite = (*nextsite)(); - out_site(bottomsite); - ELinitialize(); - - newsite = (*nextsite)(); - while (1) { - if (!PQempty()) - newintstar = PQ_min(); - - if (newsite != (struct Site *)NULL && - (PQempty() || newsite->coord.y < newintstar.y || - (newsite->coord.y == newintstar.y && - newsite->coord.x < newintstar.x))) {/* new site is smallest */ - out_site(newsite); - lbnd = ELleftbnd(&(newsite->coord)); - rbnd = ELright(lbnd); - bot = rightreg(lbnd); - e = bisect(bot, newsite); - bisector = HEcreate(e, le); - ELinsert(lbnd, bisector); - if ((p = intersect(lbnd, bisector)) != (struct Site *)NULL) { - PQdelete(lbnd); - PQinsert(lbnd, p, dist(p, newsite)); - }; - lbnd = bisector; - bisector = HEcreate(e, re); - ELinsert(lbnd, bisector); - if ((p = intersect(bisector, rbnd)) != (struct Site *)NULL) { - PQinsert(bisector, p, dist(p, newsite)); - }; - newsite = (*nextsite)(); - } else if (!PQempty()) - /* intersection is smallest */ - { - lbnd = PQextractmin(); - llbnd = ELleft(lbnd); - rbnd = ELright(lbnd); - rrbnd = ELright(rbnd); - bot = leftreg(lbnd); - top = rightreg(rbnd); - out_triple(bot, top, rightreg(lbnd)); - v = lbnd->vertex; - makevertex(v); - endpoint(lbnd->ELedge, lbnd->ELpm, v); - endpoint(rbnd->ELedge, rbnd->ELpm, v); - ELdelete(lbnd); - PQdelete(rbnd); - ELdelete(rbnd); - pm = le; - if (bot->coord.y > top->coord.y) { - temp = bot; - bot = top; - top = temp; - pm = re; - } - e = bisect(bot, top); - bisector = HEcreate(e, pm); - ELinsert(llbnd, bisector); - endpoint(e, re - pm, v); - deref(v); - if ((p = intersect(llbnd, bisector)) != (struct Site *)NULL) { - PQdelete(llbnd); - PQinsert(llbnd, p, dist(p, bot)); - }; - if ((p = intersect(bisector, rrbnd)) != (struct Site *)NULL) { - PQinsert(bisector, p, dist(p, bot)); - }; - } else - break; - }; - - for (lbnd = ELright(ELleftend); lbnd != ELrightend; lbnd = ELright(lbnd)) { - e = lbnd->ELedge; - out_ep(e); - }; -} |