Graphviz 16.0.1~dev.20260815.2250
Loading...
Searching...
No Matches
xlabels.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 v2.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#include "config.h"
12
13#include <assert.h>
14#include <errno.h>
15#include <limits.h>
16#include <math.h>
17#include <stdbool.h>
18#include <stdio.h>
19#include <stdlib.h>
20#include <string.h>
21#define XLABEL_INT
22#include <label/xlabels.h>
23#include <util/alloc.h>
24#include <util/exit.h>
25
26static int icompare(void *, void *);
27
28Dtdisc_t Hdisc = {offsetof(HDict_t, key), sizeof(int), -1, 0, 0, icompare};
29
30static int icompare(void *v1, void *v2) {
31 const int k1 = *(int *)v1;
32 const int k2 = *(int *)v2;
33 if (k1 < k2) {
34 return -1;
35 }
36 if (k1 > k2) {
37 return 1;
38 }
39 return 0;
40}
41
42static XLabels_t *xlnew(object_t *objs, size_t n_objs) {
43 XLabels_t *xlp = gv_alloc(sizeof(XLabels_t));
44
45 /* used to load the rtree in hilbert space filling curve order */
46 if (!(xlp->hdx = dtopen(&Hdisc, Dtobag))) {
47 fprintf(stderr, "out of memory\n");
48 graphviz_exit(EXIT_FAILURE);
49 }
50
51 /* for querying intersection candidates */
52 xlp->spdx = RTreeOpen();
53 /* save arg pointers in the handle */
54 xlp->objs = objs;
55 xlp->n_objs = n_objs;
56
57 return xlp;
58}
59
60static void xlfree(XLabels_t *xlp) {
61 RTreeClose(xlp->spdx);
62 free(xlp);
63}
64
65/***************************************************************************/
66
67/*
68 * determine the order(depth) of the hilbert sfc so that we satisfy the
69 * precondition of hd_hil_s_from_xy()
70 *
71 * @param obj_bb Bounding box of all objects
72 */
73static unsigned int xlhorder(boxf obj_bb) {
74 double maxx = obj_bb.UR.x, maxy = obj_bb.UR.y;
75 return (unsigned)floor(log2(round(fmax(maxx, maxy)))) + 1;
76}
77
78/* from http://www.hackersdelight.org/ site for the book by Henry S Warren */
79/*
80 * precondition
81 * pow(2, n) >= max(p.x, p.y)
82 */
83/* adapted from lams1.c
84Given the "order" n of a Hilbert curve and coordinates x and y, this
85program computes the length s of the curve from the origin to (x, y).
86The square that the Hilbert curve traverses is of size 2**n by 2**n.
87 The method is that given in [Lam&Shap], described by the following
88table. Here i = n-1 for the most significant bit of x and y, and i = 0
89for the least significant bits.
90
91 x[i] y[i] | s[2i+1:2i] x y
92 -----------|-------------------
93 0 0 | 00 y x
94 0 1 | 01 x y
95 1 0 | 11 ~y ~x
96 1 1 | 10 x y
97
98To use this table, start at the most significant bits of x and y
99(i = n - 1). If they are both 0 (first row), set the most significant
100two bits of s to 00 and interchange x and y. (Actually, it is only
101necessary to interchange the remaining bits of x and y.) If the most
102significant bits of x and y are 10 (third row), output 11, interchange x
103and y, and complement x and y.
104 Then, consider the next most significant bits of x and y (which may
105have been changed by this process), and select the appropriate row of
106the table to determine the next two bits of s, and how to change x and
107y. Continue until the least significant bits of x and y have been
108processed. */
109
110static unsigned hd_hil_s_from_xy(point p, unsigned n) {
111 int x = p.x, y = p.y;
112
113 unsigned s = 0; /* Initialize. */
114 for (unsigned i = n - 1; n > 0; i--) {
115 int xi = (x >> i) & 1; /* Get bit i of x. */
116 int yi = (y >> i) & 1; /* Get bit i of y. */
117 s = 4 * s + 2 * (unsigned)xi +
118 ((unsigned)xi ^ (unsigned)yi); // Append two bits to s.
119
120 x = x ^ y; /* These 3 lines swap */
121 y = y ^ (x & (yi - 1)); /* x and y if yi = 0. */
122 x = x ^ y;
123 x = x ^ (-xi & (yi - 1)); /* Complement x and y if */
124 y = y ^ (-xi & (yi - 1)); /* xi = 1 and yi = 0. */
125 if (i == 0) {
126 break;
127 }
128 }
129 return s;
130}
131
132/* intersection test from
133 * from Real-Time Collision Detection 4.2.1 by Christer Ericson
134 * intersection area from
135 * http://stackoverflow.com/questions/4549544/total-area-of-intersecting-rectangles
136 */
137static double aabbaabb(Rect_t r, Rect_t s) {
138 if (!Overlap(r, s))
139 return 0;
140
141 /* if we get here we have an intersection */
142
143 /* rightmost left edge of the 2 rectangles */
144 double iminx = fmax(r.boundary[0], s.boundary[0]);
145 /* upmost bottom edge */
146 double iminy = fmax(r.boundary[1], s.boundary[1]);
147 /* leftmost right edge */
148 double imaxx = fmin(r.boundary[2], s.boundary[2]);
149 /* downmost top edge */
150 double imaxy = fmin(r.boundary[3], s.boundary[3]);
151 return (imaxx - iminx) * (imaxy - iminy);
152}
153
154/*
155 * test if objp1, a size 0 object is enclosed in the xlabel
156 * associated with objp
157 */
158static bool lblenclosing(object_t *objp, object_t *objp1) {
159 xlabel_t *xlp = objp->lbl;
160
161 assert(objp1->sz.x == 0 && objp1->sz.y == 0);
162
163 if (!xlp)
164 return false;
165
166 return objp1->pos.x > xlp->pos.x && objp1->pos.x < xlp->pos.x + xlp->sz.x &&
167 objp1->pos.y > xlp->pos.y && objp1->pos.y < xlp->pos.y + xlp->sz.y;
168}
169
170/*fill in rectangle from the object */
171static Rect_t objp2rect(const object_t *op) {
172 Rect_t r = {0};
173 r.boundary[0] = round(op->pos.x);
174 r.boundary[1] = round(op->pos.y);
175 r.boundary[2] = round(op->pos.x + op->sz.x);
176 r.boundary[3] = round(op->pos.y + op->sz.y);
177 return r;
178}
179
180/*fill in rectangle from the objects xlabel */
181static Rect_t objplp2rect(const object_t *objp) {
182 Rect_t r = {0};
183 const xlabel_t *lp = objp->lbl;
184 r.boundary[0] = round(lp->pos.x);
185 r.boundary[1] = round(lp->pos.y);
186 r.boundary[2] = round(lp->pos.x + lp->sz.x);
187 r.boundary[3] = round(lp->pos.y + lp->sz.y);
188 return r;
189}
190
191/* compute boundary that encloses all possible label boundaries */
192static Rect_t objplpmks(object_t *objp) {
193 Rect_t rect;
194 pointf p = {0};
195
196 if (objp->lbl)
197 p = objp->lbl->sz;
198
199 rect.boundary[0] = floor(objp->pos.x - p.x);
200 rect.boundary[1] = floor(objp->pos.y - p.y);
201
202 rect.boundary[2] = ceil(objp->pos.x + objp->sz.x + p.x);
203 rect.boundary[3] = ceil(objp->pos.y + objp->sz.y + p.y);
204
205 return rect;
206}
207
208/* determine the position clp will occupy in intrsx[] */
209static int getintrsxi(object_t *op, object_t *cp) {
210 xlabel_t *lp = op->lbl, *clp = cp->lbl;
211 assert(lp != clp);
212
213 if (!lp->set || !clp->set)
214 return -1;
215 if ((op->pos.x == 0.0 && op->pos.y == 0.0) ||
216 (cp->pos.x == 0.0 && cp->pos.y == 0.0))
217 return -1;
218
219 if (cp->pos.y < op->pos.y) {
220 if (cp->pos.x < op->pos.x)
221 return XLPXPY;
222 if (cp->pos.x > op->pos.x)
223 return XLNXPY;
224 return XLCXPY;
225 }
226 if (cp->pos.y > op->pos.y) {
227 if (cp->pos.x < op->pos.x)
228 return XLPXNY;
229 if (cp->pos.x > op->pos.x)
230 return XLNXNY;
231 return XLCXNY;
232 }
233 if (cp->pos.x < op->pos.x)
234 return XLPXCY;
235 if (cp->pos.x > op->pos.x)
236 return XLNXCY;
237
238 return -1;
239}
240
241/* record the intersecting objects label */
242static double recordointrsx(object_t *op, object_t *cp, Rect_t rp, double a,
243 object_t *intrsx[XLNBR]) {
244 int i = getintrsxi(op, cp);
245 if (i < 0)
246 i = 5;
247 if (intrsx[i] != NULL) {
248 double sa, maxa = 0.0;
249 /* keep maximally overlapping object */
250 Rect_t srect = objp2rect(intrsx[i]);
251 sa = aabbaabb(rp, srect);
252 if (sa > a)
253 maxa = sa;
254 /*keep maximally overlapping label */
255 if (intrsx[i]->lbl) {
256 srect = objplp2rect(intrsx[i]);
257 sa = aabbaabb(rp, srect);
258 if (sa > a)
259 maxa = fmax(sa, maxa);
260 }
261 if (maxa > 0.0)
262 return maxa;
263 /*replace overlapping label/object pair */
264 intrsx[i] = cp;
265 return a;
266 }
267 intrsx[i] = cp;
268 return a;
269}
270
271/* record the intersecting label */
272static double recordlintrsx(object_t *op, object_t *cp, Rect_t *rp, double a,
273 object_t *intrsx[XLNBR]) {
274 int i = getintrsxi(op, cp);
275 if (i < 0)
276 i = 5;
277 if (intrsx[i] != NULL) {
278 double sa, maxa = 0.0;
279 /* keep maximally overlapping object */
280 Rect_t srect = objp2rect(intrsx[i]);
281 sa = aabbaabb(*rp, srect);
282 if (sa > a)
283 maxa = sa;
284 /*keep maximally overlapping label */
285 if (intrsx[i]->lbl) {
286 srect = objplp2rect(intrsx[i]);
287 sa = aabbaabb(*rp, srect);
288 if (sa > a)
289 maxa = fmax(sa, maxa);
290 }
291 if (maxa > 0.0)
292 return maxa;
293 /*replace overlapping label/object pair */
294 intrsx[i] = cp;
295 return a;
296 }
297 intrsx[i] = cp;
298 return a;
299}
300
301/* find the objects and labels intersecting lp */
302static BestPos_t xlintersections(XLabels_t *xlp, object_t *objp,
303 object_t *intrsx[XLNBR]) {
304 assert(objp->lbl);
305
306 BestPos_t bp = {.pos = objp->lbl->pos};
307
308 for (size_t i = 0; i < xlp->n_objs; i++) {
309 if (objp == &xlp->objs[i])
310 continue;
311 if (xlp->objs[i].sz.x > 0 && xlp->objs[i].sz.y > 0)
312 continue;
313 if (lblenclosing(objp, &xlp->objs[i])) {
314 bp.n++;
315 }
316 }
317
318 Rect_t rect = objplp2rect(objp);
319
320 LeafList_t *llp = RTreeSearch(xlp->spdx, xlp->spdx->root, rect);
321 if (!llp)
322 return bp;
323
324 for (LeafList_t *ilp = llp; ilp; ilp = ilp->next) {
325 double a;
326 object_t *cp = ilp->leaf->data;
327
328 if (cp == objp)
329 continue;
330
331 /*label-object intersect */
332 Rect_t srect = objp2rect(cp);
333 a = aabbaabb(rect, srect);
334 if (a > 0.0) {
335 const double ra = recordointrsx(objp, cp, rect, a, intrsx);
336 bp.n++;
337 bp.area += ra;
338 }
339 /*label-label intersect */
340 if (!cp->lbl || !cp->lbl->set)
341 continue;
342 srect = objplp2rect(cp);
343 a = aabbaabb(rect, srect);
344 if (a > 0.0) {
345 const double ra = recordlintrsx(objp, cp, &rect, a, intrsx);
346 bp.n++;
347 bp.area += ra;
348 }
349 }
351 return bp;
352}
353
354/*
355 * xladjust - find a label position
356 * the individual tests at the top are intended to place a preference order
357 * on the position
358 */
359static BestPos_t xladjust(XLabels_t *xlp, object_t *objp) {
360 xlabel_t *lp = objp->lbl;
361 double xincr = (2 * lp->sz.x + objp->sz.x) / XLXDENOM;
362 double yincr = (2 * lp->sz.y + objp->sz.y) / XLYDENOM;
363 object_t *intrsx[XLNBR] = {0};
364
365 assert(objp->lbl);
366
367 /*x left */
368 lp->pos.x = objp->pos.x - lp->sz.x;
369 /*top */
370 lp->pos.y = objp->pos.y + objp->sz.y;
371 BestPos_t bp = xlintersections(xlp, objp, intrsx);
372 if (bp.n == 0)
373 return bp;
374 /*mid */
375 lp->pos.y = objp->pos.y;
376 BestPos_t nbp = xlintersections(xlp, objp, intrsx);
377 if (nbp.n == 0)
378 return nbp;
379 if (nbp.area < bp.area)
380 bp = nbp;
381 /*bottom */
382 lp->pos.y = objp->pos.y - lp->sz.y;
383 nbp = xlintersections(xlp, objp, intrsx);
384 if (nbp.n == 0)
385 return nbp;
386 if (nbp.area < bp.area)
387 bp = nbp;
388
389 /*x mid */
390 lp->pos.x = objp->pos.x;
391 /*top */
392 lp->pos.y = objp->pos.y + objp->sz.y;
393 nbp = xlintersections(xlp, objp, intrsx);
394 if (nbp.n == 0)
395 return nbp;
396 if (nbp.area < bp.area)
397 bp = nbp;
398 /*bottom */
399 lp->pos.y = objp->pos.y - lp->sz.y;
400 nbp = xlintersections(xlp, objp, intrsx);
401 if (nbp.n == 0)
402 return nbp;
403 if (nbp.area < bp.area)
404 bp = nbp;
405
406 /*x right */
407 lp->pos.x = objp->pos.x + objp->sz.x;
408 /*top */
409 lp->pos.y = objp->pos.y + objp->sz.y;
410 nbp = xlintersections(xlp, objp, intrsx);
411 if (nbp.n == 0)
412 return nbp;
413 if (nbp.area < bp.area)
414 bp = nbp;
415 /*mid */
416 lp->pos.y = objp->pos.y;
417 nbp = xlintersections(xlp, objp, intrsx);
418 if (nbp.n == 0)
419 return nbp;
420 if (nbp.area < bp.area)
421 bp = nbp;
422 /*bottom */
423 lp->pos.y = objp->pos.y - lp->sz.y;
424 nbp = xlintersections(xlp, objp, intrsx);
425 if (nbp.n == 0)
426 return nbp;
427 if (nbp.area < bp.area)
428 bp = nbp;
429
430 /*sliding from top left */
431 if (intrsx[XLPXNY] || intrsx[XLCXNY] || intrsx[XLNXNY] || intrsx[XLPXCY] ||
432 intrsx[XLPXPY]) { /* have to move */
433 if (!intrsx[XLCXNY] && !intrsx[XLNXNY]) { /* some room right? */
434 /* slide along upper edge */
435 for (lp->pos.x = objp->pos.x - lp->sz.x,
436 lp->pos.y = objp->pos.y + objp->sz.y;
437 lp->pos.x <= (objp->pos.x + objp->sz.x); lp->pos.x += xincr) {
438 nbp = xlintersections(xlp, objp, intrsx);
439 if (nbp.n == 0)
440 return nbp;
441 if (nbp.area < bp.area)
442 bp = nbp;
443 }
444 }
445 if (!intrsx[XLPXCY] && !intrsx[XLPXPY]) { /* some room down? */
446 /* slide down left edge */
447 for (lp->pos.x = objp->pos.x - lp->sz.x,
448 lp->pos.y = objp->pos.y + objp->sz.y;
449 lp->pos.y >= (objp->pos.y - lp->sz.y); lp->pos.y -= yincr) {
450 nbp = xlintersections(xlp, objp, intrsx);
451 if (nbp.n == 0)
452 return nbp;
453 if (nbp.area < bp.area)
454 bp = nbp;
455 }
456 }
457 }
458
459 /*sliding from bottom right */
460 lp->pos.x = objp->pos.x + objp->sz.x;
461 lp->pos.y = objp->pos.y - lp->sz.y;
462 if (intrsx[XLNXPY] || intrsx[XLCXPY] || intrsx[XLPXPY] || intrsx[XLNXCY] ||
463 intrsx[XLNXNY]) { /* have to move */
464 if (!intrsx[XLCXPY] && !intrsx[XLPXPY]) { /* some room left? */
465 /* slide along lower edge */
466 for (lp->pos.x = objp->pos.x + objp->sz.x,
467 lp->pos.y = objp->pos.y - lp->sz.y;
468 lp->pos.x >= (objp->pos.x - lp->sz.x); lp->pos.x -= xincr) {
469 nbp = xlintersections(xlp, objp, intrsx);
470 if (nbp.n == 0)
471 return nbp;
472 if (nbp.area < bp.area)
473 bp = nbp;
474 }
475 }
476 if (!intrsx[XLNXCY] && !intrsx[XLNXNY]) { /* some room up? */
477 /* slide up right edge */
478 for (lp->pos.x = objp->pos.x + objp->sz.x,
479 lp->pos.y = objp->pos.y - lp->sz.y;
480 lp->pos.y <= (objp->pos.y + objp->sz.y); lp->pos.y += yincr) {
481 nbp = xlintersections(xlp, objp, intrsx);
482 if (nbp.n == 0)
483 return nbp;
484 if (nbp.area < bp.area)
485 bp = nbp;
486 }
487 }
488 }
489 return bp;
490}
491
492/* load the hilbert sfc keyed tree
493 *
494 * @param obj_bb Bounding box of all objects
495 */
496static int xlhdxload(XLabels_t *xlp, boxf obj_bb) {
497 const unsigned order = xlhorder(obj_bb);
498
499 for (size_t i = 0; i < xlp->n_objs; i++) {
500 HDict_t *hp = gv_alloc(sizeof(HDict_t));
501
502 hp->d.data = &xlp->objs[i];
503 hp->d.rect = objplpmks(&xlp->objs[i]);
504 /* center of the labeling area */
505 const double x = hp->d.rect.boundary[0] +
506 (hp->d.rect.boundary[2] - hp->d.rect.boundary[0]) / 2;
507 const double y = hp->d.rect.boundary[1] +
508 (hp->d.rect.boundary[3] - hp->d.rect.boundary[1]) / 2;
509 assert(x >= INT_MIN && x <= INT_MAX);
510 assert(y >= INT_MIN && y <= INT_MAX);
511 const point pi = {.x = (int)x, .y = (int)y};
512
513 hp->key = hd_hil_s_from_xy(pi, order);
514
515 if (!dtinsert(xlp->hdx, hp))
516 return -1;
517 }
518 return 0;
519}
520
521static void xlhdxunload(XLabels_t *xlp) {
522 int size = dtsize(xlp->hdx), freed = 0;
523 while (dtsize(xlp->hdx)) {
524 void *vp = dtfinger(xlp->hdx);
525 assert(vp);
526 if (vp) {
527 dtdetach(xlp->hdx, vp);
528 free(vp);
529 freed++;
530 }
531 }
532 assert(size == freed);
533 (void)size;
534}
535
536static void xlspdxload(XLabels_t *xlp) {
537 for (HDict_t *op = dtfirst(xlp->hdx); op; op = dtnext(xlp->hdx, op)) {
538 // tree rectangle data node
539 RTreeInsert(xlp->spdx, op->d.rect, op->d.data, &xlp->spdx->root);
540 }
541}
542
544static int xlinitialize(XLabels_t *xlp, boxf obj_bb) {
545 int r = 0;
546 if ((r = xlhdxload(xlp, obj_bb)) < 0)
547 return r;
548 xlspdxload(xlp);
549 xlhdxunload(xlp);
550 return dtclose(xlp->hdx);
551}
552
553int placeLabels(object_t *objs, size_t n_objs, const label_params_t *params) {
554 int r;
555 XLabels_t *xlp = xlnew(objs, n_objs);
556 if ((r = xlinitialize(xlp, params->bb)) < 0) {
557 xlfree(xlp);
558 return r;
559 }
560
561 /* Place xlabel_t* lp near lp->obj so that the rectangle whose lower-left
562 * corner is lp->pos, and size is lp->sz does not intersect any object
563 * in objs (by convention, an object consisting of a single point
564 * intersects nothing) nor any other label, if possible. On input,
565 * lp->set is false.
566 *
567 * On output, any label with a position should have this stored in
568 * lp->pos and have lp->set true.
569 *
570 * If params->force is true, all labels must be positioned, even if
571 * overlaps are necessary.
572 *
573 * Return 0 if all labels could be placed without overlap;
574 * non-zero otherwise.
575 */
576 r = 0;
577 for (size_t i = 0; i < n_objs; i++) {
578 if (objs[i].lbl == 0)
579 continue;
580 const BestPos_t bp = xladjust(xlp, &objs[i]);
581 if (bp.n == 0) {
582 objs[i].lbl->set = true;
583 } else if (bp.area == 0) {
584 objs[i].lbl->pos = bp.pos;
585 objs[i].lbl->set = true;
586 } else if (params->force) {
587 objs[i].lbl->pos = bp.pos;
588 objs[i].lbl->set = true;
589 } else {
590 r = 1;
591 }
592 }
593 xlfree(xlp);
594 return r;
595}
Memory allocation wrappers that exit on failure.
static void * gv_alloc(size_t size)
Definition alloc.h:47
CDT_API Dtmethod_t * Dtobag
ordered multiset
Definition dttree.c:307
#define dtdetach(d, o)
Definition cdt.h:188
CDT_API int dtsize(Dt_t *)
Definition dtsize.c:14
#define dtfinger(d)
Definition cdt.h:178
#define dtinsert(d, o)
Definition cdt.h:186
CDT_API int dtclose(Dt_t *)
Definition dtclose.c:10
CDT_API Dt_t * dtopen(Dtdisc_t *, Dtmethod_t *)
Definition dtopen.c:11
#define dtnext(d, o)
Definition cdt.h:181
#define dtfirst(d)
Definition cdt.h:180
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
void free(void *)
node NULL
Definition grammar.y:181
void RTreeLeafListFree(LeafList_t *llp)
Definition index.c:37
RTree_t * RTreeOpen(void)
Definition index.c:48
void RTreeClose(RTree_t *rtp)
Definition index.c:81
int RTreeInsert(RTree_t *rtp, Rect_t r, void *data, Node_t **n)
Definition index.c:170
LeafList_t * RTreeSearch(RTree_t *rtp, Node_t *n, Rect_t r)
Definition index.c:130
bool Overlap(const Rect_t r, const Rect_t s)
Definition rectangle.c:103
struct LeafList * next
Definition index.h:61
double boundary[NUMSIDES]
Definition rectangle.h:21
Definition geom.h:41
pointf UR
Definition geom.h:41
bool force
if true, all labels must be placed
Definition xlabels.h:38
xlabel_t * lbl
Definition xlabels.h:33
pointf pos
Definition xlabels.h:31
pointf sz
Definition xlabels.h:32
Definition geom.h:27
int y
Definition geom.h:27
int x
Definition geom.h:27
double x
Definition geom.h:29
double y
Definition geom.h:29
bool set
true if the position has been set (input/output)
Definition xlabels.h:27
pointf sz
Definition xlabels.h:24
pointf pos
Definition xlabels.h:25
Definition grammar.c:90
static BestPos_t xlintersections(XLabels_t *xlp, object_t *objp, object_t *intrsx[XLNBR])
Definition xlabels.c:302
static double aabbaabb(Rect_t r, Rect_t s)
Definition xlabels.c:137
Dtdisc_t Hdisc
Definition xlabels.c:28
static double recordlintrsx(object_t *op, object_t *cp, Rect_t *rp, double a, object_t *intrsx[XLNBR])
Definition xlabels.c:272
static unsigned int xlhorder(boxf obj_bb)
Definition xlabels.c:73
static int xlhdxload(XLabels_t *xlp, boxf obj_bb)
Definition xlabels.c:496
static void xlfree(XLabels_t *xlp)
Definition xlabels.c:60
static void xlspdxload(XLabels_t *xlp)
Definition xlabels.c:536
static Rect_t objplp2rect(const object_t *objp)
Definition xlabels.c:181
static Rect_t objp2rect(const object_t *op)
Definition xlabels.c:171
static void xlhdxunload(XLabels_t *xlp)
Definition xlabels.c:521
static double recordointrsx(object_t *op, object_t *cp, Rect_t rp, double a, object_t *intrsx[XLNBR])
Definition xlabels.c:242
static XLabels_t * xlnew(object_t *objs, size_t n_objs)
Definition xlabels.c:42
static int getintrsxi(object_t *op, object_t *cp)
Definition xlabels.c:209
static bool lblenclosing(object_t *objp, object_t *objp1)
Definition xlabels.c:158
static BestPos_t xladjust(XLabels_t *xlp, object_t *objp)
Definition xlabels.c:359
int placeLabels(object_t *objs, size_t n_objs, const label_params_t *params)
Definition xlabels.c:553
static Rect_t objplpmks(object_t *objp)
Definition xlabels.c:192
static unsigned hd_hil_s_from_xy(point p, unsigned n)
Definition xlabels.c:110
static int xlinitialize(XLabels_t *xlp, boxf obj_bb)
Definition xlabels.c:544
static int icompare(void *, void *)
Definition xlabels.c:30