Rev 10 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 3806 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | PQinitialize() ; |
24 | PQinitialize() ; |
25 | bottomsite = (*nextsite)() ; |
25 | bottomsite = (*nextsite)() ; |
26 | out_site(bottomsite) ; |
26 | out_site(bottomsite) ; |
27 | ELinitialize() ; |
27 | ELinitialize() ; |
28 | newsite = (*nextsite)() ; |
28 | newsite = (*nextsite)() ; |
- | 29 | newintstar.x = 0; /* gcc -Wall */ |
|
- | 30 | newintstar.y = 0; /* gcc -Wall */ |
|
29 | while (1) |
31 | while (1) |
30 | { |
32 | { |
31 | if(!PQempty()) |
33 | if(!PQempty()) |
32 | { |
34 | { |
33 | newintstar = PQ_min() ; |
35 | newintstar = PQ_min() ; |
34 | } |
36 | } |
35 | if (newsite != (Site *)NULL && (PQempty() |
37 | if (newsite != (Site *)NULL && (PQempty() |
36 | || newsite -> coord.y < newintstar.y |
38 | || newsite -> coord.y < newintstar.y |
37 | || (newsite->coord.y == newintstar.y |
39 | || (newsite->coord.y == newintstar.y |
38 | && newsite->coord.x < newintstar.x))) |
40 | && newsite->coord.x < newintstar.x))) |
39 | smallest */ |
- | |
40 | { |
41 | {/* new site is smallest */ |
41 | out_site(newsite) ; |
42 | out_site(newsite) ; |
- | 43 | lbnd = ELleftbnd(&(newsite->coord)) ; |
|
- | 44 | rbnd = ELright(lbnd) ; |
|
- | 45 | bot = rightreg(lbnd) ; |
|
- | 46 | e = bisect(bot, newsite) ; |
|
- | 47 | bisector = HEcreate(e, le) ; |
|
- | 48 | ELinsert(lbnd, bisector) ; |
|
- | 49 | p = intersect(lbnd, bisector) ; |
|
- | 50 | if (p != (Site *)NULL) |
|
- | 51 | { |
|
- | 52 | PQdelete(lbnd) ; |
|
- | 53 | PQinsert(lbnd, p, dist(p,newsite)) ; |
|
- | 54 | } |
|
- | 55 | lbnd = bisector ; |
|
- | 56 | bisector = HEcreate(e, re) ; |
|
- | 57 | ELinsert(lbnd, bisector) ; |
|
- | 58 | p = intersect(bisector, rbnd) ; |
|
- | 59 | if (p != (Site *)NULL) |
|
- | 60 | { |
|
- | 61 | PQinsert(bisector, p, dist(p,newsite)) ; |
|
- | 62 | } |
|
- | 63 | newsite = (*nextsite)() ; |
|
42 | } |
64 | } |
43 | lbnd = ELleftbnd(&(newsite->coord)) ; |
- | |
44 | rbnd = ELright(lbnd) ; |
- | |
45 | bot = rightreg(lbnd) ; |
- | |
46 | e = bisect(bot, newsite) ; |
- | |
47 | bisector = HEcreate(e, le) ; |
- | |
48 | ELinsert(lbnd, bisector) ; |
- | |
49 | p = intersect(lbnd, bisector) ; |
- | |
50 | if (p != (Site *)NULL) |
- | |
51 | { |
- | |
52 | PQdelete(lbnd) ; |
- | |
53 | PQinsert(lbnd, p, dist(p,newsite)) ; |
- | |
54 | } |
- | |
55 | lbnd = bisector ; |
- | |
56 | bisector = HEcreate(e, re) ; |
- | |
57 | ELinsert(lbnd, bisector) ; |
- | |
58 | p = intersect(bisector, rbnd) ; |
- | |
59 | if (p != (Site *)NULL) |
- | |
60 | { |
- | |
61 | PQinsert(bisector, p, dist(p,newsite)) ; |
- | |
62 | } |
- | |
63 | newsite = (*nextsite)() ; |
- | |
64 | } |
- | |
65 | else if (!PQempty()) /* intersection is smallest */ |
65 | else if (!PQempty()) /* intersection is smallest */ |
66 | { |
66 | { |
67 | lbnd = PQextractmin() ; |
67 | lbnd = PQextractmin() ; |
68 | llbnd = ELleft(lbnd) ; |
68 | llbnd = ELleft(lbnd) ; |
69 | rbnd = ELright(lbnd) ; |
69 | rbnd = ELright(lbnd) ; |
70 | rrbnd = ELright(rbnd) ; |
70 | rrbnd = ELright(rbnd) ; |