7
int PQmin, PQcount, PQhashsize ;
11
PQinsert(Halfedge * he, Site * v, double offset)
13
Halfedge * last, * next ;
17
he->ystar = v->coord.y + offset ;
18
last = &PQhash[ PQbucket(he)] ;
19
while ((next = last->PQnext) != (Halfedge *)NULL &&
20
(he->ystar > next->ystar ||
21
(he->ystar == next->ystar &&
22
v->coord.x > next->vertex->coord.x)))
26
he->PQnext = last->PQnext ;
32
PQdelete(Halfedge * he)
36
if(he -> vertex != (Site *) NULL)
38
last = &PQhash[PQbucket(he)] ;
39
while (last -> PQnext != he)
43
last->PQnext = he->PQnext;
46
he->vertex = (Site *)NULL ;
51
PQbucket(Halfedge * he)
56
if (he->ystar < ymin) bucket = 0;
57
else if (he->ystar >= ymax) bucket = PQhashsize-1;
58
else bucket = (he->ystar - ymin)/deltay * PQhashsize;
63
if (bucket >= PQhashsize)
65
bucket = PQhashsize-1 ;
77
return (PQcount == 0) ;
86
while (PQhash[PQmin].PQnext == (Halfedge *)NULL)
90
answer.x = PQhash[PQmin].PQnext->vertex->coord.x ;
91
answer.y = PQhash[PQmin].PQnext->ystar ;
100
curr = PQhash[PQmin].PQnext ;
101
PQhash[PQmin].PQnext = curr->PQnext ;
111
PQcount = PQmin = 0 ;
112
PQhashsize = 4 * sqrt_nsites ;
113
PQhash = (Halfedge *)myalloc(PQhashsize * sizeof *PQhash) ;
114
for (i = 0 ; i < PQhashsize; i++)
116
PQhash[i].PQnext = (Halfedge *)NULL ;