24 static int ELhashsize;
26 static int ntry, totalsearch;
43 for (i = 0; i < ELhashsize; i += 1)
68 if (e1->
reg[1] == e2->
reg[1])
71 d = e1->
a * e2->
b - e1->
b * e2->
a;
72 if (-1.0e-10 < d && d < 1.0e-10)
75 xint = (e1->
c * e2->
b - e2->
c * e1->
b) / d;
76 yint = (e2->
c * e1->
a - e1->
c * e2->
a) / d;
87 right_of_site = xint >= e->
reg[1]->
coord.
x;
88 if ((right_of_site && el->
ELpm ==
le) ||
89 (!right_of_site && el->
ELpm ==
re))
104 int right_of_site, above, fast;
105 double dxp, dyp, dxs, t1, t2, t3, yl;
109 right_of_site = p->
x > topsite->
coord.
x;
110 if (right_of_site && el->
ELpm ==
le)
112 if (!right_of_site && el->
ELpm ==
re)
119 if ((!right_of_site & (e->
b < 0.0)) |
120 (right_of_site & (e->
b >= 0.0))) {
121 above = dyp >= e->
b * dxp;
124 above = p->
x + p->
y * e->
b > e->
c;
132 above = e->
b * (dxp * dxp - dyp * dyp) <
133 dxs * dyp * (1.0 + 2.0 * dxp / dxs + e->
b * e->
b);
138 yl = e->
c - e->
a * p->
x;
141 t3 = yl - topsite->
coord.
y;
142 above = t1 * t1 > t2 * t2 + t3 * t3;
144 return (el->
ELpm ==
le ? above : !above);
173 if (b < 0 || b >= ELhashsize)
195 if (bucket >= ELhashsize)
196 bucket = ELhashsize - 1;
197 he = ELgethash(bucket);
199 for (i = 1; 1; i += 1) {
209 if (he == ELleftend || (he != ELrightend &&
right_of(he, p))) {
212 }
while (he != ELrightend &&
right_of(he, p));
217 }
while (he != ELleftend && !
right_of(he, p));
220 if (bucket > 0 && bucket < ELhashsize - 1) {
Site * rightreg(Halfedge *he)
void ELinsert(Halfedge *lb, Halfedge *new)
void * getfree(Freelist *)
Halfedge * HEcreate(Edge *e, char pm)
Site * hintersect(Halfedge *el1, Halfedge *el2)
Halfedge * ELright(Halfedge *he)
void makefree(void *, Freelist *)
void ELdelete(Halfedge *he)
Halfedge * ELleftbnd(Point *p)
Site * leftreg(Halfedge *he)
Halfedge * ELleft(Halfedge *he)
int right_of(Halfedge *el, Point *p)
struct Halfedge * ELright
char * el(GVJ_t *job, char *template,...)
void freeinit(Freelist *, int)