Graphviz 14.0.3~dev.20251104.0241
Loading...
Searching...
No Matches
multispline.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include <assert.h>
12#include <float.h>
13#include <limits.h>
15#include <neatogen/delaunay.h>
16#include <neatogen/neatoprocs.h>
17#include <math.h>
18#include <stdbool.h>
19#include <stddef.h>
20#include <util/alloc.h>
21#include <util/gv_math.h>
22
23static bool spline_merge(node_t * n)
24{
25 (void)n;
26 return false;
27}
28
29static bool swap_ends_p(edge_t * e)
30{
31 (void)e;
32 return false;
33}
34
36 .splineMerge = spline_merge};
37
38typedef struct {
39 int i, j;
40} ipair;
41
42typedef struct _tri {
44 struct _tri *nxttri;
46
47typedef struct {
48 Ppoly_t poly; /* base polygon used for routing an edge */
49 tri **triMap; /* triMap[j] is list of all opposite sides of
50 triangles containing vertex j, represented
51 as the indices of the two points in poly */
52} tripoly_t;
53
54/*
55 * Support for map from I x I -> I
56 */
57typedef struct {
58 Dtlink_t link; /* cdt data */
59 int a[2]; /* key */
60 int t;
61} item;
62
63static int cmpItem(void *item1, void *item2) {
64 const int *p1 = item1;
65 const int *p2 = item2;
66 if (p1[0] < p2[0]) return -1;
67 if (p1[0] > p2[0]) return 1;
68 if (p1[1] < p2[1]) return -1;
69 if (p1[1] > p2[1]) return 1;
70 return 0;
71}
72
73static void *newItem(void *p, Dtdisc_t *disc) {
74 item *objp = p;
75 item *newp = gv_alloc(sizeof(item));
76
77 (void)disc;
78 newp->a[0] = objp->a[0];
79 newp->a[1] = objp->a[1];
80 newp->t = objp->t;
81
82 return newp;
83}
84
86 .key = offsetof(item, a),
87 .size = 2 * sizeof(int),
88 .link = offsetof(item, link),
89 .makef = newItem,
90 .freef = free,
91 .comparf = cmpItem,
92};
93
94static void addMap(Dt_t * map, int a, int b, int t)
95{
96 item it;
97 if (a > b) {
98 SWAP(&a, &b);
99 }
100 it.a[0] = a;
101 it.a[1] = b;
102 it.t = t;
103 dtinsert(map, &it);
104}
105
106/* Create mapping from indices of side endpoints to triangle id
107 * We use a set rather than a bag because the segments used for lookup
108 * will always be a side of a polygon and hence have a unique triangle.
109 */
111{
112 Dt_t *map = dtopen(&itemdisc, Dtoset);
113 int i, a, b, c;
114 int *ps = sf->faces;
115 for (i = 0; i < sf->nfaces; i++) {
116 a = *ps++;
117 b = *ps++;
118 c = *ps++;
119 addMap(map, a, b, i);
120 addMap(map, b, c, i);
121 addMap(map, c, a, i);
122 }
123 return map;
124}
125
126static int findMap(Dt_t * map, int a, int b)
127{
128 item it;
129 item *ip;
130 if (a > b) {
131 SWAP(&a, &b);
132 }
133 it.a[0] = a;
134 it.a[1] = b;
135 ip = dtsearch(map, &it);
136 assert(ip);
137 return ip->t;
138}
139
140/*
141 * Support for map from I -> I
142 */
143
144typedef struct {
145 Dtlink_t link; /* cdt data */
146 int i; /* key */
147 int j;
148} Ipair;
149
150static int cmpIpair(void *pair1, void *pair2) {
151 const int *p1 = pair1;
152 const int *p2 = pair2;
153 if (*p1 < *p2) {
154 return -1;
155 }
156 if (*p1 > *p2) {
157 return 1;
158 }
159 return 0;
160}
161
162static void *newIpair(void *p, Dtdisc_t *disc) {
163 Ipair *objp = p;
164 Ipair *newp = gv_alloc(sizeof(Ipair));
165
166 (void)disc;
167 newp->i = objp->i;
168 newp->j = objp->j;
169
170 return newp;
171}
172
174 .key = offsetof(Ipair, i),
175 .size = sizeof(int),
176 .link = offsetof(Ipair, link),
177 .makef = newIpair,
178 .freef = free,
179 .comparf = cmpIpair,
180};
181
182static void vmapAdd(Dt_t * map, int i, int j)
183{
184 Ipair obj;
185 obj.i = i;
186 obj.j = j;
187 dtinsert(map, &obj);
188}
189
190static int vMap(Dt_t * map, int i)
191{
192 Ipair *ip;
193 ip = dtmatch(map, &i);
194 return ip->j;
195}
196
198static void mapTri(Dt_t * map, tri * tp)
199{
200 for (; tp; tp = tp->nxttri) {
201 tp->v.i = vMap(map, tp->v.i);
202 tp->v.j = vMap(map, tp->v.j);
203 }
204}
205
206static tri *
207addTri(int i, int j, tri * oldp)
208{
209 tri *tp = gv_alloc(sizeof(tri));
210 tp->v.i = i;
211 tp->v.j = j;
212 tp->nxttri = oldp;
213 return tp;
214}
215
217static double bisect(pointf pp, pointf cp, pointf np)
218{
219 double theta, phi;
220 theta = atan2(np.y - cp.y, np.x - cp.x);
221 phi = atan2(pp.y - cp.y, pp.x - cp.x);
222 return (theta + phi) / 2.0;
223}
224
226static int raySeg(pointf v, pointf w, pointf a, pointf b)
227{
228 int wa = wind(v, w, a);
229 int wb = wind(v, w, b);
230 if (wa == wb)
231 return 0;
232 if (wa == 0) {
233 return wind(v, b, w) * wind(v, b, a) >= 0;
234 } else {
235 return wind(v, a, w) * wind(v, a, b) >= 0;
236 }
237}
238
239/* Find the point p where ray v->w intersects segment ai-bi, if any.
240 * Return 1 on success, 0 on failure
241 */
242static int
244{
245 if (raySeg(v, w, a, b))
246 return line_intersect(v, w, a, b, p);
247 else
248 return 0;
249}
250
251/* Given the triangle vertex v, and point w so that v->w points
252 * into the polygon, return where the ray v->w intersects the
253 * polygon. The search uses all of the opposite sides of triangles
254 * with v as vertex.
255 * Return 0 on success; 1 on failure.
256 */
257static int
258triPoint(tripoly_t * trip, int vx, pointf v, pointf w, pointf * ip)
259{
260 tri *tp;
261
262 for (tp = trip->triMap[vx]; tp; tp = tp->nxttri) {
264 (v, w, trip->poly.ps[tp->v.i], trip->poly.ps[tp->v.j], ip))
265 return 0;
266 }
267 return 1;
268}
269
270/* Find the index of v in the points polys->ps.
271 * We start at 1 since the point corresponding to 0
272 * will never be used as v.
273 */
274static int ctrlPtIdx(pointf v, Ppoly_t * polys)
275{
276 pointf w;
277 for (size_t i = 1; i < polys->pn; i++) {
278 w = polys->ps[i];
279 if (w.x == v.x && w.y == v.y) {
280 assert(i <= INT_MAX);
281 return (int)i;
282 }
283 }
284 return -1;
285}
286
287#define SEP 15
288
289/* Generate mult points associated with v.
290 * The points will lie on the ray bisecting the angle prev--v--nxt.
291 * The first point will always be v.
292 * The rest are positioned equally spaced with maximum spacing SEP.
293 * In addition, they all lie within the polygon trip->poly.
294 * Parameter s gives the index after which a vertex lies on the
295 * opposite side. This is necessary to get the "curvature" of the
296 * path correct.
297 */
298static pointf *mkCtrlPts(int s, int mult, pointf prev, pointf v,
299 pointf nxt, tripoly_t * trip)
300{
301 int idx = ctrlPtIdx(v, &trip->poly);
302 int i;
303 double d, sep, theta, sinTheta, cosTheta;
304 pointf q, w;
305
306 if (idx < 0)
307 return NULL;
308
309 pointf *ps = gv_calloc(mult, sizeof(pointf));
310 theta = bisect(prev, v, nxt);
311 sinTheta = sin(theta);
312 cosTheta = cos(theta);
313 w.x = v.x + 100 * cosTheta;
314 w.y = v.y + 100 * sinTheta;
315 if (idx > s) {
316 if (wind(prev, v, w) != 1) {
317 sinTheta *= -1;
318 cosTheta *= -1;
319 w.x = v.x + 100 * cosTheta;
320 w.y = v.y + 100 * sinTheta;
321 }
322 } else if (wind(prev, v, w) != -1) {
323 sinTheta *= -1;
324 cosTheta *= -1;
325 w.x = v.x + 100 * cosTheta;
326 w.y = v.y + 100 * sinTheta;
327 }
328
329 if (triPoint(trip, idx, v, w, &q)) {
330 return 0;
331 }
332
333 d = DIST(q, v);
334 if (d >= mult * SEP)
335 sep = SEP;
336 else
337 sep = d / mult;
338 if (idx < s) {
339 for (i = 0; i < mult; i++) {
340 ps[i].x = v.x + i * sep * cosTheta;
341 ps[i].y = v.y + i * sep * sinTheta;
342 }
343 } else {
344 for (i = 0; i < mult; i++) {
345 ps[mult - i - 1].x = v.x + i * sep * cosTheta;
346 ps[mult - i - 1].y = v.y + i * sep * sinTheta;
347 }
348 }
349 return ps;
350}
351
352/*
353 * Simple graph structure for recording the triangle graph.
354 */
355
356typedef struct {
357 size_t ne; // no. of edges.
358 int *edges; /* indices of edges adjacent to node. */
359 pointf ctr; /* center of triangle. */
360} tnode;
361
362typedef struct {
363 int t, h; /* indices of head and tail nodes */
364 ipair seg; /* indices of points forming shared segment */
365 double dist; /* length of edge; usually distance between centers */
366} tedge;
367
368typedef struct {
370 size_t nnodes; // number of nodes
372 int nedges; // number of edges
373} tgraph;
374
375struct router_s {
376 int pn; /* no. of points */
377 pointf *ps; /* all points in configuration */
378 int *obs; /* indices in obstacle i are obs[i]...obs[i+1]-1 */
379 int *tris; /* indices of triangle i are tris[3*i]...tris[3*i+2] */
380 Dt_t *trimap; /* map from obstacle side (a,b) to index of adj. triangle */
381 int tn; /* no. of nodes in tg */
382 tgraph *tg; /* graph of triangles */
383};
384
385/* Given an array of points and 3 integer indices,
386 * compute and return the center of the triangle.
387 */
388static pointf triCenter(pointf * pts, int *idxs)
389{
390 pointf a = pts[*idxs++];
391 pointf b = pts[*idxs++];
392 pointf c = pts[*idxs++];
393 pointf p;
394 p.x = (a.x + b.x + c.x) / 3.0;
395 p.y = (a.y + b.y + c.y) / 3.0;
396 return p;
397}
398
399#define MARGIN 32
400
401/* Compute bounding box of polygons, and return it
402 * with an added margin of MARGIN.
403 * Store total number of points in *np.
404 */
405static boxf bbox(Ppoly_t** obsp, int npoly, int *np)
406{
407 boxf bb;
408 int i, cnt = 0;
409 pointf p;
410 Ppoly_t* obs;
411
412 bb.LL.x = bb.LL.y = DBL_MAX;
413 bb.UR.x = bb.UR.y = -DBL_MAX;
414
415 for (i = 0; i < npoly; i++) {
416 obs = *obsp++;
417 for (size_t j = 0; j < obs->pn; j++) {
418 p = obs->ps[j];
419 bb.LL.x = fmin(bb.LL.x, p.x);
420 bb.UR.x = fmax(bb.UR.x, p.x);
421 bb.LL.y = fmin(bb.LL.y, p.y);
422 bb.UR.y = fmax(bb.UR.y, p.y);
423 cnt++;
424 }
425 }
426
427 *np = cnt;
428
429 bb.LL.x -= MARGIN;
430 bb.LL.y -= MARGIN;
431 bb.UR.x += MARGIN;
432 bb.UR.y += MARGIN;
433
434 return bb;
435}
436
437static int *mkTriIndices(surface_t * sf)
438{
439 int *tris = gv_calloc(3 * sf->nfaces, sizeof(int));
440 memcpy(tris, sf->faces, 3 * sf->nfaces * sizeof(int));
441 return tris;
442}
443
444/* Returns a pair of integer (x,y), x < y, where x and y are the
445 * indices of the two vertices of the shared edge.
446 */
447static ipair sharedEdge(int *p, int *q)
448{
449 ipair pt;
450 int p1, p2;
451 p1 = *p;
452 p2 = *(p + 1);
453 if (p1 == *q) {
454 if (p2 != *(q + 1) && p2 != *(q + 2)) {
455 p2 = *(p + 2);
456 }
457 } else if (p1 == *(q + 1)) {
458 if (p2 != *q && p2 != *(q + 2)) {
459 p2 = *(p + 2);
460 }
461 } else if (p1 == *(q + 2)) {
462 if (p2 != *q && p2 != *(q + 1)) {
463 p2 = *(p + 2);
464 }
465 } else {
466 p1 = *(p + 2);
467 }
468
469 if (p1 > p2) {
470 SWAP(&p1, &p2);
471 }
472 pt.i = p1;
473 pt.j = p2;
474 return pt;
475}
476
477/* Add an edge to g, with tail t, head h, and shared
478 * segment seg.
479 */
480static void addTriEdge(tgraph *g, int t, int h, ipair seg) {
481 g->edges = gv_recalloc(g->edges, g->nedges, g->nedges + 1,
482 sizeof(g->edges[0]));
483 tedge *ep = g->edges + g->nedges;
484 tnode *tp = g->nodes + t;
485 tnode *hp = g->nodes + h;
486
487 ep->t = t;
488 ep->h = h;
489 ep->dist = DIST(tp->ctr, hp->ctr);
490 ep->seg = seg;
491
492 tp->edges = gv_recalloc(tp->edges, tp->ne, tp->ne + 1,
493 sizeof(tp->edges[0]));
494 tp->edges[tp->ne++] = g->nedges;
495 hp->edges = gv_recalloc(hp->edges, hp->ne, hp->ne + 1,
496 sizeof(hp->edges[0]));
497 hp->edges[hp->ne++] = g->nedges;
498
499 g->nedges++;
500}
501
502static void freeTriGraph(tgraph * tg)
503{
504 for (size_t i = 0; i < tg->nnodes; ++i) {
505 free(tg->nodes[i].edges);
506 }
507 free(tg->nodes);
508 free(tg->edges);
509 free(tg);
510}
511
512/* Generate graph with triangles as nodes and an edge iff two triangles
513 * share an edge.
514 */
515static tgraph *mkTriGraph(surface_t *sf, pointf *pts) {
516 tnode *np;
517 int j, i, ne = 0;
518 int *jp;
519
520 /* ne is twice no. of edges */
521 for (i = 0; i < 3 * sf->nfaces; i++)
522 if (sf->neigh[i] != -1)
523 ne++;
524
525 tgraph *g = gv_alloc(sizeof(tgraph));
526
527 /* plus 2 for nodes added as endpoints of an edge */
528 g->nnodes = sf->nfaces + 2;
529 g->nodes = gv_calloc(g->nnodes, sizeof(tnode));
530
531 for (i = 0; i < sf->nfaces; i++) {
532 np = g->nodes + i;
533 np->ctr = triCenter(pts, sf->faces + 3 * i);
534 }
535
536 for (i = 0; i < sf->nfaces; i++) {
537 np = g->nodes + i;
538 jp = sf->neigh + 3 * i;
539 ne = 0;
540 while (ne < 3 && (j = *jp++) != -1) {
541 if (i < j) {
542 ipair seg =
543 sharedEdge(sf->faces + 3 * i, sf->faces + 3 * j);
544 addTriEdge(g, i, j, seg);
545 }
546 ne++;
547 }
548 }
549
550 return g;
551}
552
554{
555 free(rtr->ps);
556 free(rtr->obs);
557 free(rtr->tris);
558 dtclose(rtr->trimap);
559 freeTriGraph(rtr->tg);
560 free(rtr);
561}
562
563router_t *mkRouter(Ppoly_t** obsp, int npoly)
564{
565 router_t *rtr = gv_alloc(sizeof(router_t));
566 Ppoly_t* obs;
567 boxf bb;
568 int npts;
569 surface_t *sf;
570 /* points in obstacle i have indices obsi[i] through obsi[i+1]-1 in pts
571 */
572 int *obsi = gv_calloc(npoly + 1, sizeof(int));
573 int i, ix = 4, six = 0;
574
575 bb = bbox(obsp, npoly, &npts);
576 npts += 4; /* 4 points of bounding box */
577 pointf *pts = gv_calloc(npts, sizeof(pointf)); // all points are stored in pts
578 int *segs = gv_calloc(2 * npts, sizeof(int)); // indices of points forming segments
579
580 /* store bounding box in CCW order */
581 pts[0] = bb.LL;
582 pts[1].x = bb.UR.x;
583 pts[1].y = bb.LL.y;
584 pts[2] = bb.UR;
585 pts[3].x = bb.LL.x;
586 pts[3].y = bb.UR.y;
587 for (i = 1; i <= 4; i++) {
588 segs[six++] = i - 1;
589 if (i < 4)
590 segs[six++] = i;
591 else
592 segs[six++] = 0;
593 }
594
595 /* store obstacles in CW order and generate constraint segments */
596 for (i = 0; i < npoly; i++) {
597 obsi[i] = ix;
598 obs = *obsp++;
599 for (size_t j = 1; j <= obs->pn; j++) {
600 segs[six++] = ix;
601 if (j < obs->pn)
602 segs[six++] = ix + 1;
603 else
604 segs[six++] = obsi[i];
605 pts[ix++] = obs->ps[j - 1];
606 }
607 }
608 obsi[i] = ix;
609
610 /* copy points into coordinate arrays */
611 double *x = gv_calloc(npts, sizeof(double));
612 double *y = gv_calloc(npts, sizeof(double));
613 for (i = 0; i < npts; i++) {
614 x[i] = pts[i].x;
615 y[i] = pts[i].y;
616 }
617 sf = mkSurface(x, y, npts, segs, npts);
618 free(x);
619 free(y);
620 free(segs);
621
622 rtr->ps = pts;
623 rtr->pn = npts;
624 rtr->obs = obsi;
625 rtr->tris = mkTriIndices(sf);
626 rtr->trimap = mapSegToTri(sf);
627 rtr->tn = sf->nfaces;
628 rtr->tg = mkTriGraph(sf, pts);
629
630 freeSurface(sf);
631 return rtr;
632}
633
634/* Finish edge generation, clipping to nodes and adding arrowhead
635 * if necessary, and adding edge labels
636 */
637static void finishEdge(edge_t* e, Ppoly_t spl, int flip) {
638 if (flip) {
639 for (size_t j = 0; j < spl.pn / 2; j++) {
640 SWAP(&spl.ps[spl.pn - 1 - j], &spl.ps[j]);
641 }
642 }
643 if (Verbose > 1)
644 fprintf(stderr, "spline %s %s\n", agnameof(agtail(e)), agnameof(aghead(e)));
645 clip_and_install(e, aghead(e), spl.ps, spl.pn, &sinfo);
646
647 addEdgeLabels(e);
648}
649
650#define EQPT(p,q) (((p).x==(q).x)&&((p).y==(q).y))
651
652/* Hack because path routing doesn't know about the interiors
653 * of polygons. If the first or last segment of the shortest path
654 * lies along one of the polygon boundaries, the path may flip
655 * inside the polygon. To avoid this, we shift the point a bit.
656 *
657 * If the edge p(=poly.ps[s])-q of the shortest path is also an
658 * edge of the border polygon, move p slightly inside the polygon
659 * and return it. If prv and nxt are the two vertices adjacent to
660 * p in the polygon, let m be the midpoint of prv--nxt. We then
661 * move a tiny bit along the ray p->m.
662 *
663 * Otherwise, return p unchanged.
664 */
666 Ppoint_t prv, nxt, p;
667
668 p = poly.ps[s];
669 nxt = poly.ps[(s + 1) % poly.pn];
670 if (s == 0)
671 prv = poly.ps[poly.pn-1];
672 else
673 prv = poly.ps[s - 1];
674 if (EQPT(q, nxt) || EQPT(q, prv) ){
675 Ppoint_t m;
676 m.x = (nxt.x + prv.x)/2.0 - p.x;
677 m.y = (nxt.y + prv.y)/2.0 - p.y;
678 const double d = hypot(m.x, m.y);
679 p.x += 0.1*m.x/d;
680 p.y += 0.1*m.y/d;
681 }
682 return p;
683}
684
685static void tweakPath(Ppoly_t poly, size_t t, Ppolyline_t pl) {
686 pl.ps[0] = tweakEnd(poly, 0, pl.ps[1]);
687 pl.ps[pl.pn-1] = tweakEnd (poly, t, pl.ps[pl.pn-2]);
688}
689
690
691/* Generate splines for e and cohorts.
692 * Edges go from 0 to t.
693 * Return 0 on success.
694 */
695static int genroute(tripoly_t *trip, int t, edge_t *e, int doPolyline) {
696 pointf eps[2];
697 pointf **cpts = NULL; /* lists of control points */
699 Ppolyline_t pl, spl;
700 Ppolyline_t mmpl;
701 int mult = ED_count(e);
702 node_t* head = aghead(e);
703 int rv = 0;
704
705 poly.ps = NULL;
706 pl.pn = 0;
707 eps[0].x = trip->poly.ps[0].x, eps[0].y = trip->poly.ps[0].y;
708 eps[1].x = trip->poly.ps[t].x, eps[1].y = trip->poly.ps[t].y;
709 if (Pshortestpath(&(trip->poly), eps, &pl) < 0) {
710 agwarningf("Could not create control points for multiple spline for edge (%s,%s)\n", agnameof(agtail(e)), agnameof(aghead(e)));
711 rv = 1;
712 goto finish;
713 }
714
715 if (pl.pn == 2) {
716 makeStraightEdge(agraphof(head), e, doPolyline, &sinfo);
717 goto finish;
718 }
719
720 if (mult == 1 || Concentrate) {
721 poly = trip->poly;
722 Pedge_t *medges = gv_calloc(poly.pn, sizeof(Pedge_t));
723 for (size_t j = 0; j < poly.pn; j++) {
724 medges[j].a = poly.ps[j];
725 medges[j].b = poly.ps[(j + 1) % poly.pn];
726 }
727 assert(t >= 0);
728 tweakPath(poly, (size_t)t, pl);
729 if (Proutespline(medges, poly.pn, pl, (Pvector_t[2]){0}, &spl) < 0) {
730 agwarningf("Could not create control points for multiple spline for edge (%s,%s)\n", agnameof(agtail(e)), agnameof(aghead(e)));
731 rv = 1;
732 goto finish;
733 }
734 finishEdge(e, spl, aghead(e) != head);
735 free(medges);
736
737 return 0;
738 }
739
740 const size_t pn = 2 * (pl.pn - 1);
741
742 cpts = gv_calloc(pl.pn - 2, sizeof(pointf *));
743 for (size_t i = 0; i + 2 < pl.pn; i++) {
744 cpts[i] =
745 mkCtrlPts(t, mult+1, pl.ps[i], pl.ps[i + 1], pl.ps[i + 2], trip);
746 if (!cpts[i]) {
747 agwarningf("Could not create control points for multiple spline for edge (%s,%s)\n", agnameof(agtail(e)), agnameof(aghead(e)));
748 rv = 1;
749 goto finish;
750 }
751 }
752
753 poly.ps = gv_calloc(pn, sizeof(pointf));
754 poly.pn = pn;
755
756 for (int i = 0; i < mult; i++) {
757 poly.ps[0] = eps[0];
758 for (size_t j = 1; j + 1 < pl.pn; j++) {
759 poly.ps[j] = cpts[j - 1][i];
760 }
761 poly.ps[pl.pn - 1] = eps[1];
762 for (size_t j = 1; j + 1 < pl.pn; j++) {
763 poly.ps[pn - j] = cpts[j - 1][i + 1];
764 }
765 if (Pshortestpath(&poly, eps, &mmpl) < 0) {
766 agwarningf("Could not create control points for multiple spline for edge (%s,%s)\n", agnameof(agtail(e)), agnameof(aghead(e)));
767 rv = 1;
768 goto finish;
769 }
770
771 if (doPolyline) {
772 make_polyline (mmpl, &spl);
773 }
774 else {
775 Pedge_t *medges = gv_calloc(poly.pn, sizeof(Pedge_t));
776 for (size_t j = 0; j < poly.pn; j++) {
777 medges[j].a = poly.ps[j];
778 medges[j].b = poly.ps[(j + 1) % poly.pn];
779 }
780 tweakPath(poly, pl.pn - 1, mmpl);
781 const bool failed_routing =
782 Proutespline(medges, poly.pn, mmpl, (Pvector_t[2]){0}, &spl) < 0;
783 free(medges);
784 if (failed_routing) {
785 agwarningf("Could not create control points for multiple spline for edge (%s,%s)\n",
786 agnameof(agtail(e)), agnameof(aghead(e)));
787 rv = 1;
788 goto finish;
789 }
790 }
791 finishEdge(e, spl, aghead(e) != head);
792
793 e = ED_to_virt(e);
794 }
795
796finish :
797 if (cpts) {
798 for (size_t i = 0; i + 2 < pl.pn; i++)
799 free(cpts[i]);
800 free(cpts);
801 }
802 free(poly.ps);
803 return rv;
804}
805
806#define NSMALL -0.0000000001
807
809static int
811{
812 return area2(q,a,b) >= NSMALL && area2(q,b,c) >= NSMALL;
813}
814
815static pointf north = {0, 1};
816static pointf northeast = {1, 1};
817static pointf east = {1, 0};
818static pointf southeast = {1, -1};
819static pointf south = {0, -1};
820static pointf southwest = {-1, -1};
821static pointf west = {-1, 0};
822static pointf northwest = {-1, 1};
823
824/* Add node to graph representing spline end point p inside obstruction obs_id.
825 * For each side of obstruction, add edge from p to corresponding triangle.
826 * The node id of the new node in the graph is v_id.
827 * If p lies on the side of its node (sides != 0), we limit the triangles
828 * to those within 45 degrees of each side of the natural direction of p.
829 */
830static void addEndpoint(router_t * rtr, pointf p, node_t* v, int v_id, int sides)
831{
832 int obs_id = ND_lim(v);
833 int starti = rtr->obs[obs_id];
834 int endi = rtr->obs[obs_id + 1];
835 pointf* pts = rtr->ps;
836 int i, t;
837 pointf vr, v0, v1;
838
839 switch (sides) {
840 case TOP :
841 vr = add_pointf (p, north);
842 v0 = add_pointf (p, northwest);
843 v1 = add_pointf (p, northeast);
844 break;
845 case TOP|RIGHT :
846 vr = add_pointf (p, northeast);
847 v0 = add_pointf (p, north);
848 v1 = add_pointf (p, east);
849 break;
850 case RIGHT :
851 vr = add_pointf (p, east);
852 v0 = add_pointf (p, northeast);
853 v1 = add_pointf (p, southeast);
854 break;
855 case BOTTOM|RIGHT :
856 vr = add_pointf (p, southeast);
857 v0 = add_pointf (p, east);
858 v1 = add_pointf (p, south);
859 break;
860 case BOTTOM :
861 vr = add_pointf (p, south);
862 v0 = add_pointf (p, southeast);
863 v1 = add_pointf (p, southwest);
864 break;
865 case BOTTOM|LEFT :
866 vr = add_pointf (p, southwest);
867 v0 = add_pointf (p, south);
868 v1 = add_pointf (p, west);
869 break;
870 case LEFT :
871 vr = add_pointf (p, west);
872 v0 = add_pointf (p, southwest);
873 v1 = add_pointf (p, northwest);
874 break;
875 case TOP|LEFT :
876 vr = add_pointf (p, northwest);
877 v0 = add_pointf (p, west);
878 v1 = add_pointf (p, north);
879 break;
880 case 0 :
881 break;
882 default :
883 assert (0);
884 break;
885 }
886
887 rtr->tg->nodes[v_id].ne = 0;
888 rtr->tg->nodes[v_id].ctr = p;
889 for (i = starti; i < endi; i++) {
890 ipair seg;
891 seg.i = i;
892 if (i < endi - 1)
893 seg.j = i + 1;
894 else
895 seg.j = starti;
896 t = findMap(rtr->trimap, seg.i, seg.j);
897 if (sides && !inCone (v0, p, v1, pts[seg.i]) && !inCone (v0, p, v1, pts[seg.j]) && !raySeg(p,vr,pts[seg.i],pts[seg.j]))
898 continue;
899 addTriEdge(rtr->tg, v_id, t, seg);
900 }
901 assert(rtr->tg->nodes[v_id].ne > 0 && "no edges were added");
902}
903
904/* Given edge from i to j, find segment associated
905 * with the edge.
906 *
907 * This lookup could be made faster by modifying the
908 * shortest path algorithm to store the edges rather than
909 * the nodes.
910 */
911static ipair edgeToSeg(tgraph * tg, int i, int j)
912{
913 ipair ip = {0, 0};
914 tnode *np = tg->nodes + i;
915 tedge *ep;
916
917 for (size_t k = 0; k < np->ne; k++) {
918 ep = tg->edges + np->edges[k];
919 if (ep->t == j || ep->h == j)
920 return ep->seg;
921 }
922
923 assert(0);
924 return ip;
925}
926
927static void
929{
930 tri* tp;
931 tri* nxt;
932
933 free (trip->poly.ps);
934 for (size_t i = 0; i < trip->poly.pn; i++) {
935 for (tp = trip->triMap[i]; tp; tp = nxt) {
936 nxt = tp->nxttri;
937 free (tp);
938 }
939 }
940 free (trip->triMap);
941 free (trip);
942}
943
944/* Auxiliary data structure used to translate a path of rectangles
945 * into a polygon. Each side_t represents a vertex on one side of
946 * the polygon. v is the index of the vertex in the global router_t,
947 * and ts is a linked list of the indices of segments of sides opposite
948 * to v in some triangle on the path. These lists will be translated
949 * to polygon indices by mapTri, and stored in tripoly_t.triMap.
950 */
951typedef struct {
952 int v;
954} side_t;
955
956/* Construct simple polygon from shortest path from t to s in g.
957 * dad gives the indices of the triangles on path.
958 * sx used to store index of s in points.
959 * index of t is always 0
960 */
961static tripoly_t *mkPoly(router_t * rtr, int *dad, int s, int t,
962 pointf p_s, pointf p_t, int *sx)
963{
964 tripoly_t *ps;
965 int nxt;
966 ipair p;
967 size_t nt = 0;
968 int idx;
969 int cnt1 = 0;
970 int cnt2 = 0;
971 pointf *pts;
972 /* maps vertex index used in router_t to vertex index used in tripoly */
973 Dt_t *vmap;
974
975 /* count number of triangles in path */
976 for (nxt = dad[t]; nxt != s; nxt = dad[nxt]) {
977 nt++;
978 assert (nxt != dad[nxt] && "infinite loop due to 'nxt' not changing");
979 }
980
981 side_t *side1 = gv_calloc(nt + 4, sizeof(side_t));
982 side_t *side2 = gv_calloc(nt + 4, sizeof(side_t));
983
984 nxt = dad[t];
985 p = edgeToSeg(rtr->tg, nxt, t);
986 side1[cnt1].ts = addTri(-1, p.j, NULL);
987 side1[cnt1++].v = p.i;
988 side2[cnt2].ts = addTri(-1, p.i, NULL);
989 side2[cnt2++].v = p.j;
990
991 t = nxt;
992 for (nxt = dad[t]; nxt >= 0; nxt = dad[nxt]) {
993 p = edgeToSeg(rtr->tg, t, nxt);
994 if (p.i == side1[cnt1 - 1].v) {
995 side1[cnt1 - 1].ts =
996 addTri(side2[cnt2 - 1].v, p.j, side1[cnt1 - 1].ts);
997 side2[cnt2 - 1].ts =
998 addTri(side1[cnt1 - 1].v, p.j, side2[cnt2 - 1].ts);
999 side2[cnt2].ts =
1000 addTri(side2[cnt2 - 1].v, side1[cnt1 - 1].v, NULL);
1001 side2[cnt2++].v = p.j;
1002 } else if (p.i == side2[cnt2 - 1].v) {
1003 side1[cnt1 - 1].ts =
1004 addTri(side2[cnt2 - 1].v, p.j, side1[cnt1 - 1].ts);
1005 side2[cnt2 - 1].ts =
1006 addTri(side1[cnt1 - 1].v, p.j, side2[cnt2 - 1].ts);
1007 side1[cnt1].ts =
1008 addTri(side2[cnt2 - 1].v, side1[cnt1 - 1].v, NULL);
1009 side1[cnt1++].v = p.j;
1010 } else if (p.j == side1[cnt1 - 1].v) {
1011 side1[cnt1 - 1].ts =
1012 addTri(side2[cnt2 - 1].v, p.i, side1[cnt1 - 1].ts);
1013 side2[cnt2 - 1].ts =
1014 addTri(side1[cnt1 - 1].v, p.i, side2[cnt2 - 1].ts);
1015 side2[cnt2].ts =
1016 addTri(side2[cnt2 - 1].v, side1[cnt1 - 1].v, NULL);
1017 side2[cnt2++].v = p.i;
1018 } else {
1019 side1[cnt1 - 1].ts =
1020 addTri(side2[cnt2 - 1].v, p.i, side1[cnt1 - 1].ts);
1021 side2[cnt2 - 1].ts =
1022 addTri(side1[cnt1 - 1].v, p.i, side2[cnt2 - 1].ts);
1023 side1[cnt1].ts =
1024 addTri(side2[cnt2 - 1].v, side1[cnt1 - 1].v, NULL);
1025 side1[cnt1++].v = p.i;
1026 }
1027 t = nxt;
1028 }
1029 side1[cnt1 - 1].ts = addTri(-2, side2[cnt2 - 1].v, side1[cnt1 - 1].ts);
1030 side2[cnt2 - 1].ts = addTri(-2, side1[cnt1 - 1].v, side2[cnt2 - 1].ts);
1031
1032 /* store points in pts starting with t in 0,
1033 * then side1, then s, then side2
1034 */
1035 vmap = dtopen(&ipairdisc, Dtoset);
1036 vmapAdd(vmap, -1, 0);
1037 vmapAdd(vmap, -2, cnt1 + 1);
1038 pointf *pps = pts = gv_calloc(nt + 4, sizeof(pointf));
1039 tri **trim = gv_calloc(nt + 4, sizeof(tri*));
1040 *pps++ = p_t;
1041 idx = 1;
1042 for (int i = 0; i < cnt1; i++) {
1043 vmapAdd(vmap, side1[i].v, idx);
1044 *pps++ = rtr->ps[side1[i].v];
1045 trim[idx++] = side1[i].ts;
1046 }
1047 *pps++ = p_s;
1048 idx++;
1049 for (int i = cnt2 - 1; i >= 0; i--) {
1050 vmapAdd(vmap, side2[i].v, idx);
1051 *pps++ = rtr->ps[side2[i].v];
1052 trim[idx++] = side2[i].ts;
1053 }
1054
1055 for (size_t i = 0; i < nt + 4; i++) {
1056 mapTri(vmap, trim[i]);
1057 }
1058
1059 ps = gv_alloc(sizeof(tripoly_t));
1060 ps->poly.pn = nt + 4; /* nt triangles gives nt+2 points plus s and t */
1061 ps->poly.ps = pts;
1062 ps->triMap = trim;
1063
1064 free (side1);
1065 free (side2);
1066 dtclose(vmap);
1067 *sx = cnt1 + 1; /* index of s in ps */
1068 return ps;
1069}
1070
1072static void resetGraph(tgraph *g, int ncnt, int ecnt,
1073 size_t *original_edge_count) {
1074 int i;
1075 tnode *np = g->nodes;
1076 g->nedges = ecnt;
1077 for (i = 0; i < ncnt; i++) {
1078 np->ne = original_edge_count[i];
1079 np++;
1080 }
1081}
1082
1083#define PQTYPE int
1084#define PQVTYPE double
1085
1086#define PQ_TYPES
1087#include <neatogen/fPQ.h>
1088#undef PQ_TYPES
1089
1090typedef struct {
1091 PQ pq;
1093 int *idxs;
1094} PPQ;
1095
1096#define N_VAL(pq,n) ((PPQ*)pq)->vals[n]
1097#define N_IDX(pq,n) ((PPQ*)pq)->idxs[n]
1098
1099#define PQ_CODE
1100#include <neatogen/fPQ.h>
1101#undef PQ_CODE
1102
1103#define N_DAD(n) dad[n]
1104#define E_WT(e) (e->dist)
1105#define UNSEEN (-FLT_MAX)
1106
1107/* Find the shortest path with lengths in g from
1108 * v0 to v1. The returned vector (dad) encodes the
1109 * shorted path from v1 to v0. That path is given by
1110 * v1, dad[v1], dad[dad[v1]], ..., v0.
1111 */
1112static int *
1113triPath(tgraph * g, int n, int v0, int v1, PQ * pq)
1114{
1115 int i, adjn;
1116 double d;
1117 tnode *np;
1118 tedge *e;
1119 int *dad = gv_calloc(n, sizeof(int));
1120
1121 for (i = 0; i < pq->PQsize; i++)
1122 N_VAL(pq, i) = UNSEEN;
1123
1124 PQinit(pq);
1125 N_DAD(v0) = -1;
1126 N_VAL(pq, v0) = 0;
1127 if (PQinsert(pq, v0))
1128 return NULL;
1129
1130 while ((i = PQremove(pq)) != -1) {
1131 N_VAL(pq, i) *= -1;
1132 if (i == v1)
1133 break;
1134 np = g->nodes + i;
1135 for (size_t j = 0; j < np->ne; j++) {
1136 e = g->edges + np->edges[j];
1137 if (e->t == i)
1138 adjn = e->h;
1139 else
1140 adjn = e->t;
1141 if (N_VAL(pq, adjn) < 0) {
1142 d = -(N_VAL(pq, i) + E_WT(e));
1143 if (is_exactly_equal(N_VAL(pq, adjn), UNSEEN)) {
1144 N_VAL(pq, adjn) = d;
1145 N_DAD(adjn) = i;
1146 if (PQinsert(pq, adjn)) {
1147 free(dad);
1148 return NULL;
1149 }
1150 } else if (N_VAL(pq, adjn) < d) {
1151 PQupdate(pq, adjn, d);
1152 N_DAD(adjn) = i;
1153 }
1154 }
1155 }
1156 }
1157 return dad;
1158}
1159
1160/* FIX: we don't really use the shortest path provided by ED_path,
1161 * so avoid in neato spline code.
1162 * Return 0 on success.
1163 */
1164int makeMultiSpline(edge_t* e, router_t * rtr, int doPolyline) {
1165 Ppolyline_t line = ED_path(e);
1166 node_t *t = agtail(e);
1167 node_t *h = aghead(e);
1168 pointf t_p = line.ps[0];
1169 pointf h_p = line.ps[line.pn - 1];
1170 tripoly_t *poly;
1171 int idx;
1172 int *sp;
1173 int t_id = rtr->tn;
1174 int h_id = rtr->tn + 1;
1175 int ecnt = rtr->tg->nedges;
1176 PPQ pq;
1177 int ret;
1178
1179 // record the number of edges in each node, so we can drop the added ones
1180 // later
1181 size_t *original_edge_count = gv_calloc(rtr->tg->nnodes,
1182 sizeof(original_edge_count[0]));
1183 for (size_t i = 0; i < rtr->tg->nnodes; ++i)
1184 original_edge_count[i] = rtr->tg->nodes[i].ne;
1185
1186 /* Add endpoints to triangle graph */
1187 addEndpoint(rtr, t_p, t, t_id, ED_tail_port(e).side);
1188 addEndpoint(rtr, h_p, h, h_id, ED_head_port(e).side);
1189
1190 /* Initialize priority queue */
1191 PQgen(&pq.pq, rtr->tn + 2, -1);
1192 PQTYPE *idxs = gv_calloc(pq.pq.PQsize + 1, sizeof(PQTYPE));
1193 PQVTYPE *vals = gv_calloc(pq.pq.PQsize + 1, sizeof(PQVTYPE));
1194 vals[0] = 0;
1195 pq.vals = vals + 1;
1196 pq.idxs = idxs + 1;
1197
1198 /* Find shortest path of triangles */
1199 sp = triPath(rtr->tg, rtr->tn+2, h_id, t_id, (PQ *) & pq);
1200
1201 free(vals);
1202 free(idxs);
1203 PQfree(&(pq.pq), 0);
1204
1205 /* Use path of triangles to generate guiding polygon */
1206 if (sp) {
1207 poly = mkPoly(rtr, sp, h_id, t_id, h_p, t_p, &idx);
1208 free(sp);
1209
1210 /* Generate multiple splines using polygon */
1211 ret = genroute(poly, idx, e, doPolyline);
1212 freeTripoly (poly);
1213 }
1214 else ret = -1;
1215
1216 resetGraph(rtr->tg, rtr->tn, ecnt, original_edge_count);
1217 free(original_edge_count);
1218 return ret;
1219}
Memory allocation wrappers that exit on failure.
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
Definition alloc.h:73
static void * gv_calloc(size_t nmemb, size_t size)
Definition alloc.h:26
static void * gv_alloc(size_t size)
Definition alloc.h:47
#define dtmatch(d, o)
Definition cdt.h:185
#define dtsearch(d, o)
Definition cdt.h:184
#define dtinsert(d, o)
Definition cdt.h:186
CDT_API int dtclose(Dt_t *)
Definition dtclose.c:8
CDT_API Dtmethod_t * Dtoset
ordered set (self-adjusting tree)
Definition dttree.c:304
CDT_API Dt_t * dtopen(Dtdisc_t *, Dtmethod_t *)
Definition dtopen.c:9
#define LEFT
Definition const.h:120
#define RIGHT
Definition const.h:118
#define BOTTOM
Definition const.h:117
#define TOP
Definition const.h:119
surface_t * mkSurface(double *x, double *y, int n, int *segs, int nsegs)
Definition delaunay.c:561
void freeSurface(surface_t *s)
Definition delaunay.c:573
#define head
Definition dthdr.h:15
static Dtdisc_t disc
Definition exparse.y:209
void PQinit(void)
Definition fPQ.c:44
void PQgen(int sz)
Definition fPQ.c:25
void PQfree(void)
Definition fPQ.c:36
snode * PQremove(void)
Definition fPQ.c:121
void PQupdate(snode *n, int d)
Definition fPQ.c:137
int line_intersect(pointf a, pointf b, pointf c, pointf d, pointf *p)
Definition geom.c:198
#define DIST(p, q)
Definition geom.h:56
static WUR pointf add_pointf(pointf p, pointf q)
Definition geomprocs.h:88
bool Concentrate
Definition globals.h:59
static bool Verbose
Definition gml2gv.c:24
void free(void *)
node NULL
Definition grammar.y:181
static int cnt(Dict_t *d, Dtlink_t **set)
Definition graph.c:196
#define ED_count(e)
Definition types.h:580
#define agtail(e)
Definition cgraph.h:977
#define ED_path(e)
Definition types.h:593
#define aghead(e)
Definition cgraph.h:978
#define ED_head_port(e)
Definition types.h:588
#define ED_tail_port(e)
Definition types.h:597
#define ED_to_virt(e)
Definition types.h:599
void agwarningf(const char *fmt,...)
Definition agerror.c:173
#define ND_lim(n)
Definition types.h:504
Agraph_t * agraphof(void *obj)
Definition obj.c:185
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:143
Arithmetic helper functions.
static bool is_exactly_equal(double a, double b)
are two values precisely the same?
Definition gv_math.h:48
#define SWAP(a, b)
Definition gv_math.h:134
void PQinsert(pq_t *pq, Halfedge *he, Site *v, double offset)
Definition heap.c:62
$2 prev
Definition htmlparse.y:291
static int * ps
Definition lu.c:51
static tripoly_t * mkPoly(router_t *rtr, int *dad, int s, int t, pointf p_s, pointf p_t, int *sx)
static int findMap(Dt_t *map, int a, int b)
static void addMap(Dt_t *map, int a, int b, int t)
Definition multispline.c:94
static tgraph * mkTriGraph(surface_t *sf, pointf *pts)
static pointf southwest
static void mapTri(Dt_t *map, tri *tp)
map vertex indices from router_t to tripoly_t coordinates
#define PQVTYPE
router_t * mkRouter(Ppoly_t **obsp, int npoly)
static pointf northwest
static ipair sharedEdge(int *p, int *q)
struct _tri tri
static int raySegIntersect(pointf v, pointf w, pointf a, pointf b, pointf *p)
static int * mkTriIndices(surface_t *sf)
static bool swap_ends_p(edge_t *e)
Definition multispline.c:29
static bool spline_merge(node_t *n)
Definition multispline.c:23
void freeRouter(router_t *rtr)
static void addTriEdge(tgraph *g, int t, int h, ipair seg)
#define N_DAD(n)
static int vMap(Dt_t *map, int i)
static void finishEdge(edge_t *e, Ppoly_t spl, int flip)
static pointf east
static int inCone(pointf a, pointf b, pointf c, pointf q)
returns true iff q is in the convex cone a-b-c
static void * newIpair(void *p, Dtdisc_t *disc)
static int cmpItem(void *item1, void *item2)
Definition multispline.c:63
static void resetGraph(tgraph *g, int ncnt, int ecnt, size_t *original_edge_count)
remove edges and nodes added for current edge routing
int makeMultiSpline(edge_t *e, router_t *rtr, int doPolyline)
static pointf * mkCtrlPts(int s, int mult, pointf prev, pointf v, pointf nxt, tripoly_t *trip)
static ipair edgeToSeg(tgraph *tg, int i, int j)
static void * newItem(void *p, Dtdisc_t *disc)
Definition multispline.c:73
static tri * addTri(int i, int j, tri *oldp)
static void tweakPath(Ppoly_t poly, size_t t, Ppolyline_t pl)
#define NSMALL
static int genroute(tripoly_t *trip, int t, edge_t *e, int doPolyline)
static pointf triCenter(pointf *pts, int *idxs)
static pointf northeast
static Ppoint_t tweakEnd(Ppoly_t poly, size_t s, Ppoint_t q)
#define SEP
static pointf west
static int * triPath(tgraph *g, int n, int v0, int v1, PQ *pq)
#define E_WT(e)
static Dtdisc_t itemdisc
Definition multispline.c:85
static int cmpIpair(void *pair1, void *pair2)
static int raySeg(pointf v, pointf w, pointf a, pointf b)
check if ray v->w intersects segment a–b
static pointf southeast
#define UNSEEN
#define MARGIN
static pointf north
static Dt_t * mapSegToTri(surface_t *sf)
static Dtdisc_t ipairdisc
#define N_VAL(pq, n)
static splineInfo sinfo
Definition multispline.c:35
static void freeTriGraph(tgraph *tg)
static int triPoint(tripoly_t *trip, int vx, pointf v, pointf w, pointf *ip)
static int ctrlPtIdx(pointf v, Ppoly_t *polys)
static boxf bbox(Ppoly_t **obsp, int npoly, int *np)
static pointf south
static void vmapAdd(Dt_t *map, int i, int j)
static void addEndpoint(router_t *rtr, pointf p, node_t *v, int v_id, int sides)
#define PQTYPE
static double bisect(pointf pp, pointf cp, pointf np)
return the angle bisecting the angle pp–cp–np
#define EQPT(p, q)
static void freeTripoly(tripoly_t *trip)
void make_polyline(Ppolyline_t line, Ppolyline_t *sline)
Definition util.c:59
int Proutespline(Pedge_t *barriers, size_t n_barriers, Ppolyline_t input_route, Pvector_t endpoint_slopes[2], Ppolyline_t *output_route)
Definition route.c:68
int Pshortestpath(Ppoly_t *boundary, Ppoint_t endpoints[2], Ppolyline_t *output_route)
Definition shortest.c:81
PATHUTIL_API int wind(Ppoint_t a, Ppoint_t b, Ppoint_t c)
Definition visibility.c:53
PATHUTIL_API COORD area2(Ppoint_t, Ppoint_t, Ppoint_t)
Definition visibility.c:44
void clip_and_install(edge_t *fe, node_t *hn, pointf *ps, size_t pn, splineInfo *info)
Definition splines.c:234
void makeStraightEdge(graph_t *g, edge_t *e, int edgetype, splineInfo *info)
Definition routespl.c:956
void addEdgeLabels(edge_t *e)
Definition splines.c:1305
Dtlink_t link
PQVTYPE * vals
int * idxs
Ppoint_t b
Definition pathgeom.h:53
Ppoint_t a
Definition pathgeom.h:53
size_t pn
Definition pathgeom.h:47
Ppoint_t * ps
Definition pathgeom.h:46
double x
Definition pathgeom.h:38
double y
Definition pathgeom.h:38
struct _tri * nxttri
Definition multispline.c:44
ipair v
Definition multispline.c:43
Definition geom.h:41
pointf UR
Definition geom.h:41
pointf LL
Definition geom.h:41
Definition cdt.h:98
int key
Definition cdt.h:85
int i
Definition multispline.c:39
int j
Definition multispline.c:39
Definition utils.c:750
node_t * t
Definition utils.c:753
int a[2]
Definition multispline.c:59
int t
Definition multispline.c:60
double x
Definition geom.h:29
double y
Definition geom.h:29
Definition heap.c:18
tgraph * tg
pointf * ps
Dt_t * trimap
int * tris
int * obs
tri * ts
bool(* swapEnds)(edge_t *e)
Definition types.h:67
int * faces
Definition delaunay.h:20
int nfaces
Definition delaunay.h:19
int * neigh
Definition delaunay.h:21
ipair seg
double dist
tnode * nodes
int nedges
size_t nnodes
tedge * edges
size_t ne
int * edges
pointf ctr
tri ** triMap
Definition multispline.c:49
Ppoly_t poly
Definition multispline.c:48
struct poly_s poly
Definition grammar.c:90