59 if (e1->
reg[1] == e2->
reg[1])
62 d = e1->
a * e2->
b - e1->
b * e2->
a;
63 if (-1.0e-10 < d && d < 1.0e-10)
66 xint = (e1->
c * e2->
b - e2->
c * e1->
b) / d;
67 yint = (e2->
c * e1->
a - e1->
c * e2->
a) / d;
78 right_of_site = xint >= e->
reg[1]->
coord.
x;
79 if ((right_of_site && el->
ELpm ==
le) || (!right_of_site && el->
ELpm ==
re))
94 double dxp, dyp, dxs, t1, t2, t3, yl;
98 bool right_of_site = p->
x > topsite->
coord.
x;
99 if (right_of_site && el->
ELpm ==
le)
101 if (!right_of_site && el->
ELpm ==
re)
108 if ((!right_of_site && e->
b < 0.0) || (right_of_site && e->
b >= 0.0)) {
109 above = dyp >= e->
b * dxp;
112 above = p->
x + p->
y * e->
b > e->
c;
120 above = e->
b * (dxp * dxp - dyp * dyp) <
121 dxs * dyp * (1.0 + 2.0 * dxp / dxs + e->
b * e->
b);
126 yl = e->
c - e->
a * p->
x;
129 t3 = yl - topsite->
coord.
y;
130 above = t1 * t1 > t2 * t2 + t3 * t3;
132 return el->
ELpm ==
le ? above : !above;
177static int clamp(
int lower,
double v,
int upper) {
178 assert(upper >= lower);
217 if (bucket > 0 && bucket < st->hashsize - 1) {
218 st->
hash[bucket] = he;
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
static Halfedge * ELgethash(el_state_t *st, int b)
Halfedge * ELright(Halfedge *he)
void ELcleanup(el_state_t *st)
void ELinitialize(el_state_t *st)
void ELinsert(Halfedge *lb, Halfedge *new)
Site * hintersect(Halfedge *el1, Halfedge *el2)
static int right_of(Halfedge *el, Point *p)
Site * rightreg(Halfedge *he)
Halfedge * ELleft(Halfedge *he)
static int clamp(int lower, double v, int upper)
Halfedge * ELleftbnd(el_state_t *st, Point *p)
void ELdelete(Halfedge *he)
Halfedge * HEcreate(el_state_t *st, Edge *e, char pm)
Site * leftreg(Halfedge *he)
struct Halfedge * previous_allocated
used for final clean up
struct Halfedge * ELright
Halfedge * allocated
outstanding live Halfedges