9
extern int triangulate, plot, debug ;
10
extern double ymax, ymin, xmax, xmin ;
11
extern AV *lines_out, *edges_out, *vertices_out;
13
double pxmin, pxmax, pymin, pymax, cradius;
22
line(double ax, double ay, double bx, double by)
28
circle(double ax, double ay, double radius)
34
range(double pxmin, double pxmax, double pymin, double pymax)
39
out_bisector(Edge * e)
41
if (triangulate && plot && !debug)
43
line(e->reg[0]->coord.x, e->reg[0]->coord.y,
44
e->reg[1]->coord.x, e->reg[1]->coord.y) ;
46
if (!triangulate && !plot && !debug)
48
// fprintf(stderr, "l %f %f %f %d %d\n", e->a, e->b, e->c, e->reg[le]->sitenbr, e->reg[re]->sitenbr) ;
50
vals[0] = newSVnv(e->a);
51
vals[1] = newSVnv(e->b);
52
vals[2] = newSVnv(e->c);
53
vals[3] = newSViv(e->reg[le]->sitenbr);
54
vals[4] = newSViv(e->reg[re]->sitenbr);
55
av_push(lines_out, newRV_noinc((SV*) av_make(5, vals)));
64
printf("line(%d) %gx+%gy=%g, bisecting %d %d\n", e->edgenbr,
65
e->a, e->b, e->c, e->reg[le]->sitenbr, e->reg[re]->sitenbr) ;
72
if (!triangulate && plot)
76
if (!triangulate && !plot)
78
//printf("e %d", e->edgenbr);
79
//printf(" %d ", e->ep[le] != (Site *)NULL ? e->ep[le]->sitenbr : -1) ;
80
//printf("%d\n", e->ep[re] != (Site *)NULL ? e->ep[re]->sitenbr : -1) ;
82
vals[0] = newSViv(e->edgenbr);
83
vals[1] = newSViv(e->ep[le] != (Site *)NULL ?
86
vals[2] = newSViv(e->ep[re] != (Site *)NULL ?
89
av_push(edges_out, newRV_noinc((SV*) av_make(3, vals)));
99
if (!triangulate && !plot && !debug)
101
//printf ("v %f %f\n", v->coord.x, v->coord.y) ;
103
vals[0] = newSVnv(v->coord.x);
104
vals[1] = newSVnv(v->coord.y);
105
av_push(vertices_out, newRV_noinc((SV*)av_make(2, vals)));
111
printf("vertex(%d) at %f %f\n", v->sitenbr, v->coord.x, v->coord.y) ;
118
if (!triangulate && plot && !debug)
120
circle (s->coord.x, s->coord.y, cradius) ;
122
if (!triangulate && !plot && !debug)
124
// fprintf(stderr, "s %f %f\n", s->coord.x, s->coord.y) ;
128
printf("site (%d) at %f %f\n", s->sitenbr, s->coord.x, s->coord.y) ;
133
out_triple(Site * s1, Site * s2, Site * s3)
135
if (triangulate && !plot && !debug)
137
printf("%d %d %d\n", s1->sitenbr, s2->sitenbr, s3->sitenbr) ;
141
printf("circle through left=%d right=%d bottom=%d\n",
142
s1->sitenbr, s2->sitenbr, s3->sitenbr) ;
153
d = ( dx > dy ? dx : dy) * 1.1 ;
154
pxmin = xmin - (d-dx) / 2.0 ;
155
pxmax = xmax + (d-dx) / 2.0 ;
156
pymin = ymin - (d-dy) / 2.0 ;
157
pymax = ymax + (d-dy) / 2.0 ;
158
cradius = (pxmax - pxmin) / 350.0 ;
160
range(pxmin, pymin, pxmax, pymax) ;
167
double x1, x2, y1, y2 ;
169
if (e->a == 1.0 && e->b >= 0.0)
182
if (s1 != (Site *)NULL && s1->coord.y > pymin)
190
x1 = e->c - e->b * y1 ;
192
if (s2 != (Site *)NULL && s2->coord.y < pymax)
200
x2 = e->c - e->b * y2 ;
201
if (((x1 > pxmax) && (x2 > pxmax)) || ((x1 < pxmin) && (x2 < pxmin)))
208
y1 = (e->c - x1) / e->b ;
213
y1 = (e->c - x1) / e->b ;
218
y2 = (e->c - x2) / e->b ;
223
y2 = (e->c - x2) / e->b ;
229
if (s1 != (Site *)NULL && s1->coord.x > pxmin)
237
y1 = e->c - e->a * x1 ;
239
if (s2 != (Site *)NULL && s2->coord.x < pxmax)
247
y2 = e->c - e->a * x2 ;
248
if (((y1 > pymax) && (y2 > pymax)) || ((y1 < pymin) && (y2 <pymin)))
255
x1 = (e->c - y1) / e->a ;
260
x1 = (e->c - y1) / e->a ;
265
x2 = (e->c - y2) / e->a ;
270
x2 = (e->c - y2) / e->a ;