]> granicus.if.org Git - graphviz/commitdiff
node_t.coord is now pointf
authorellson <devnull@localhost>
Thu, 11 Sep 2008 02:29:13 +0000 (02:29 +0000)
committerellson <devnull@localhost>
Thu, 11 Sep 2008 02:29:13 +0000 (02:29 +0000)
ND_coord_i(n) becomes ND_coord(n)

20 files changed:
cmd/tools/gvpack.c
lib/common/diagen.c
lib/common/emit.c
lib/common/output.c
lib/common/postproc.c
lib/common/routespl.c
lib/common/shapes.c
lib/common/splines.c
lib/common/types.h
lib/common/utils.c
lib/dotgen/compound.c
lib/dotgen/dotsplines.c
lib/dotgen/flat.c
lib/dotgen/position.c
lib/dotgen/sameport.c
lib/neatogen/neatoinit.c
lib/neatogen/neatosplines.c
lib/pack/pack.c
lib/patchwork/patchwork.c
plugin/gd/gvrender_gd_vrml.c

index aca6a2e099c827b3b55e22dedfece1215d1cafc2..578afbf20972c91e2cd6ca48e2924e2397a6cac0 100644 (file)
@@ -298,8 +298,8 @@ static void cloneEdge(Agedge_t * old, Agedge_t * new)
 static void cloneNode(Agnode_t * old, Agnode_t * new)
 {
     cloneAttrs(old, new);
-    ND_coord_i(new).x = POINTS(ND_pos(old)[0]);
-    ND_coord_i(new).y = POINTS(ND_pos(old)[1]);
+    ND_coord(new).x = POINTS(ND_pos(old)[0]);
+    ND_coord(new).y = POINTS(ND_pos(old)[1]);
     ND_height(new) = ND_height(old);
     ND_ht_i(new) = ND_ht_i(old);
     ND_width(new) = ND_width(old);
index 0ee858d557ab811b5792adfdb6489d4b1c465e86..2a422619e3310494f9281d7b31c6bf49cb00e7ca 100644 (file)
@@ -243,6 +243,20 @@ static pointf diapt(point p)
     return rv;
 }
 
+static pointf diaptf(pointf p)
+{
+    pointf rv;
+
+    if (Rot == 0) {
+       rv.x = PB.LL.x + p.x * Scale + Offset.x;
+       rv.y = PB.UR.y - 1 - p.y * Scale - Offset.y;
+    } else {
+       rv.x = PB.UR.x - 1 - p.y * Scale - Offset.x;
+       rv.y = PB.UR.y - 1 - p.x * Scale - Offset.y;
+    }
+    return rv;
+}
+
 static void dia_grstyle(context_t * cp)
 {
     if (strcmp(cp->pencolor, DEFAULT_COLOR)) {
@@ -677,7 +691,7 @@ int box_connection(node_t * n, pointf p)
     double xsize, ysize, mindist2 = 0.0, dist2;
     polygon_t *poly;
     pointf P, *vertices;
-    static point *A;
+    static pointf *A;
     static int A_size;
 
     poly = (polygon_t *) ND_shape_info(n);
@@ -687,30 +701,27 @@ int box_connection(node_t * n, pointf p)
 
     if (A_size < sides) {
        A_size = sides + 5;
-       A = ALLOC(A_size, A, point);
+       A = ALLOC(A_size, A, pointf);
     }
 
-    xsize = ((ND_lw_i(n) + ND_rw_i(n)) / POINTS(ND_width(n))) * 16.0;
-    ysize = ((ND_ht_i(n)) / POINTS(ND_height(n))) * 16.0;
+    xsize = (ND_lw_i(n) + ND_rw_i(n)) / POINTS(ND_width(n));
+    ysize = (ND_ht_i(n)) / POINTS(ND_height(n));
 
     for (j = 0; j < peripheries; j++) {
        for (i = 0; i < sides; i++) {
            P = vertices[i + j * sides];
-/* simple rounding produces random results around .5 
- * this trick should clip off the random part. 
- * (note xsize/ysize prescaled by 16.0 above) */
-           A[i].x = ROUND(P.x * xsize) / 16;
-           A[i].y = ROUND(P.y * ysize) / 16;
+           A[i].x = P.x * xsize;
+           A[i].y = P.y * ysize;
            if (sides > 2) {
-               A[i].x += ND_coord_i(n).x;
-               A[i].y += ND_coord_i(n).y;
+               A[i].x += ND_coord(n).x;
+               A[i].y += ND_coord(n).y;
            }
        }
     }
 
     z = 0;
     while (z < i) {
-       dist2 = DIST2(p, diapt(A[z]));
+       dist2 = DIST2(p, diaptf(A[z]));
        if (z == 0) {
            mindist2 = dist2;
            conn = 0;
@@ -724,8 +735,8 @@ int box_connection(node_t * n, pointf p)
 
     z = 0;
     while (z < i) {
-       P.x = (diapt(A[z]).x + diapt(A[z + 1]).x) / 2;
-       P.y = (diapt(A[z]).y + diapt(A[z + 1]).y) / 2;
+       P.x = (diaptf(A[z]).x + diaptf(A[z + 1]).x) / 2;
+       P.y = (diaptf(A[z]).y + diaptf(A[z + 1]).y) / 2;
        dist2 = DIST2(p, P);
        if (dist2 < mindist2) {
            mindist2 = dist2;
@@ -811,10 +822,10 @@ dia_bezier(point * A, int n, int arrow_at_start, int arrow_at_end, int filled)
         }
     
         dia_fputs("      <dia:attribute name=\"conn_endpoints\">\n");
-        dia_printf("        <dia:point val=\"%g,%g\"/>\n", diapt(A[0]).x,
-                  diapt(A[0]).y);
-        dia_printf("        <dia:point val=\"%g,%g\"/>\n", diapt(A[n - 1]).x,
-                  diapt(A[n - 1]).y);
+        dia_printf("        <dia:point val=\"%g,%g\"/>\n",
+               diapt(A[0]).x, diapt(A[0]).y);
+        dia_printf("        <dia:point val=\"%g,%g\"/>\n",
+               diapt(A[n - 1]).x, diapt(A[n - 1]).y);
         dia_fputs("      </dia:attribute>\n");
         dia_fputs("      <dia:connections>\n");
     
@@ -822,7 +833,7 @@ dia_bezier(point * A, int n, int arrow_at_start, int arrow_at_end, int filled)
         if ((strcmp(shape_t, "ellipse") == 0)
            || (strcmp(shape_t, "circle") == 0)
            || (strcmp(shape_t, "doublecircle") == 0)) {
-           cp_h = diapt(ND_coord_i(head));
+           cp_h = diaptf(ND_coord(head));
            if (AG_IS_DIRECTED(Rootgraph))
                conn_h = ellipse_connection(cp_h, diapt(A[n - 1]));
            else
@@ -838,7 +849,7 @@ dia_bezier(point * A, int n, int arrow_at_start, int arrow_at_end, int filled)
         if ((strcmp(shape_t, "ellipse") == 0)
            || (strcmp(shape_t, "circle") == 0)
            || (strcmp(shape_t, "doublecircle") == 0)) {
-           cp_t = diapt(ND_coord_i(tail));
+           cp_t = diaptf(ND_coord(tail));
            if (AG_IS_DIRECTED(Rootgraph))
                conn_t = ellipse_connection(cp_t, diapt(A[0]));
            else
index c6ed11dfe566188f50c6090e3f4030203a87cb9b..37703b2ba7be22a13eb3f11f88884a96ee619970 100644 (file)
@@ -1027,7 +1027,7 @@ static void emit_begin_node(GVJ_t * job, node_t * n)
     int sides, peripheries, i, j, filled = 0, rect = 0, shape, nump = 0;
     polygon_t *poly = NULL;
     pointf *vertices, ldimen, *p = NULL;
-    point coord;
+    pointf coord;
     char *s;
 
     obj = push_obj_state(job);
@@ -1049,7 +1049,7 @@ static void emit_begin_node(GVJ_t * job, node_t * n)
         /* checking shape of node */
         shape = shapeOf(n);
         /* node coordinate */
-        coord = ND_coord_i(n);
+        coord = ND_coord(n);
         /* checking if filled style has been set for node */
         filled = ifFilled(n);
 
@@ -2017,8 +2017,8 @@ static void init_job_viewport(GVJ_t * job, graph_t * g)
        if (rv == 4) {
            n = agfindnode(g->root, nodename);
            if (n) {
-               x = ND_coord_i(n).x;
-               y = ND_coord_i(n).y;
+               x = ND_coord(n).x;
+               y = ND_coord(n).y;
            }
        }
        else {
@@ -2026,8 +2026,8 @@ static void init_job_viewport(GVJ_t * job, graph_t * g)
            if (rv == 4) {
                 n = agfindnode(g->root, nodename);
                 if (n) {
-                    x = ND_coord_i(n).x;
-                    y = ND_coord_i(n).y;
+                    x = ND_coord(n).x;
+                    y = ND_coord(n).y;
                }
            }
            else {
@@ -2723,10 +2723,10 @@ static void init_bb_node(graph_t *g, node_t *n)
 {
     edge_t *e;
 
-    ND_bb(n).LL.x = ND_coord_i(n).x - ND_lw_i(n);
-    ND_bb(n).LL.y = ND_coord_i(n).y - ND_ht_i(n) / 2.;
-    ND_bb(n).UR.x = ND_coord_i(n).x + ND_rw_i(n);
-    ND_bb(n).UR.y = ND_coord_i(n).y + ND_ht_i(n) / 2.;
+    ND_bb(n).LL.x = ND_coord(n).x - ND_lw_i(n);
+    ND_bb(n).LL.y = ND_coord(n).y - ND_ht_i(n) / 2.;
+    ND_bb(n).UR.x = ND_coord(n).x + ND_rw_i(n);
+    ND_bb(n).UR.y = ND_coord(n).y + ND_ht_i(n) / 2.;
 
     for (e = agfstout(g, n); e; e = agnxtout(g, e))
         init_bb_edge(e);
index ba92159fa32bb9994da3bc959e1aa01f2747b4cb..123faa8126f339c70a9c4987095dcdea6b4dbd5d 100644 (file)
 int Y_off;           /* ymin + ymax */
 double YF_off;       /* Y_off in inches */
 
-static void printpt(FILE * f, point pt)
-{
-    fprintf(f, " %.3g %.3g", PS2INCH(pt.x), PS2INCH(YDIR(pt.y)));
-}
-
 static void printptf(FILE * f, pointf pt)
 {
     fprintf(f, " %.3g %.3g", PS2INCH(pt.x), PS2INCH(YDIR(pt.y)));
@@ -95,7 +90,7 @@ void write_plain(GVJ_t * job, graph_t * g, FILE * f, boolean extend)
        if (IS_CLUST_NODE(n))
            continue;
        fprintf(f, "node %s ", agcanonical(n->name));
-       printpt(f, ND_coord_i(n));
+       printptf(f, ND_coord(n));
        if (ND_label(n)->html)   /* if html, get original text */
            lbl = agcanonical (agxget(n, N_label->index));
        else
@@ -149,10 +144,10 @@ static void set_record_rects(node_t * n, field_t * f, agxbuf * xb)
 
     if (f->n_flds == 0) {
        sprintf(buf, "%.3g,%.3g,%.3g,%.3g ",
-               f->b.LL.x + (double)(ND_coord_i(n).x),
-               YFDIR(f->b.LL.y + (double)(ND_coord_i(n).y)),
-               f->b.UR.x + (double)(ND_coord_i(n).x),
-               YFDIR(f->b.UR.y + (double)(ND_coord_i(n).y)));
+               f->b.LL.x + ND_coord(n).x,
+               YFDIR(f->b.LL.y + ND_coord(n).y),
+               f->b.UR.x + ND_coord(n).x,
+               YFDIR(f->b.UR.y + ND_coord(n).y));
        agxbput(xb, buf);
     }
     for (i = 0; i < f->n_flds; i++)
@@ -215,14 +210,14 @@ void attach_attrs_and_arrows(graph_t* g, int* sp, int* ep)
     safe_dcl(g, g, "bb", "", agraphattr);
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
        if (dim3) {
-           sprintf(buf, "%d,%d,%d", ND_coord_i(n).x, YDIR(ND_coord_i(n).y), POINTS(ND_pos(n)[2]));
+           sprintf(buf, "%.3g,%.3g,%d", ND_coord(n).x, YDIR(ND_coord(n).y), POINTS(ND_pos(n)[2]));
        } else {
-           sprintf(buf, "%d,%d", ND_coord_i(n).x, YDIR(ND_coord_i(n).y));
+           sprintf(buf, "%.3g,%.3g", ND_coord(n).x, YDIR(ND_coord(n).y));
        }
        agset(n, "pos", buf);
-       sprintf(buf, "%.2f", PS2INCH(ND_ht_i(n)));
+       sprintf(buf, "%.3g", PS2INCH(ND_ht_i(n)));
        agxset(n, N_height->index, buf);
-       sprintf(buf, "%.2f", PS2INCH(ND_lw_i(n) + ND_rw_i(n)));
+       sprintf(buf, "%.3g", PS2INCH(ND_lw_i(n) + ND_rw_i(n)));
        agxset(n, N_width->index, buf);
        if (strcmp(ND_shape(n)->name, "record") == 0) {
            set_record_rects(n, ND_shape_info(n), &xb);
index 84f0180426d45a300ac6e36cc83496e8eb413dcd..46913bb14f07aca21394139b0233311796e49c67 100644 (file)
@@ -82,17 +82,9 @@ static void place_flip_graph_label(graph_t * g);
     closepath stroke\n\
 } def\n"
 
-static pointf map_pointf(pointf p)
+static pointf map_point(pointf p)
 {
     p = ccwrotatepf(p, Rankdir*90);
-    p.x -= (double)Offset.x;
-    p.y -= (double)Offset.y;
-    return p;
-}
-
-static point map_point(point p)
-{
-    p = ccwrotatep(p, Rankdir*90);
     p.x -= Offset.x;
     p.y -= Offset.y;
     return p;
@@ -112,19 +104,19 @@ static void map_edge(edge_t * e)
     for (j = 0; j < ED_spl(e)->size; j++) {
        bz = ED_spl(e)->list[j];
        for (k = 0; k < bz.size; k++)
-           bz.list[k] = map_pointf(bz.list[k]);
+           bz.list[k] = map_point(bz.list[k]);
        if (bz.sflag)
-           ED_spl(e)->list[j].sp = map_pointf(ED_spl(e)->list[j].sp);
+           ED_spl(e)->list[j].sp = map_point(ED_spl(e)->list[j].sp);
        if (bz.eflag)
-           ED_spl(e)->list[j].ep = map_pointf(ED_spl(e)->list[j].ep);
+           ED_spl(e)->list[j].ep = map_point(ED_spl(e)->list[j].ep);
     }
     if (ED_label(e))
-       ED_label(e)->pos = map_pointf(ED_label(e)->pos);
+       ED_label(e)->pos = map_point(ED_label(e)->pos);
     /* vladimir */
     if (ED_head_label(e))
-       ED_head_label(e)->pos = map_pointf(ED_head_label(e)->pos);
+       ED_head_label(e)->pos = map_point(ED_head_label(e)->pos);
     if (ED_tail_label(e))
-       ED_tail_label(e)->pos = map_pointf(ED_tail_label(e)->pos);
+       ED_tail_label(e)->pos = map_point(ED_tail_label(e)->pos);
 }
 
 void translate_bb(graph_t * g, int rankdir)
@@ -134,15 +126,15 @@ void translate_bb(graph_t * g, int rankdir)
 
     bb = GD_bb(g);
     if (rankdir == RANKDIR_LR || rankdir == RANKDIR_BT) {
-       new_bb.LL = map_pointf(pointfof(bb.LL.x, bb.UR.y));
-       new_bb.UR = map_pointf(pointfof(bb.UR.x, bb.LL.y));
+       new_bb.LL = map_point(pointfof(bb.LL.x, bb.UR.y));
+       new_bb.UR = map_point(pointfof(bb.UR.x, bb.LL.y));
     } else {
-       new_bb.LL = map_pointf(pointfof(bb.LL.x, bb.LL.y));
-       new_bb.UR = map_pointf(pointfof(bb.UR.x, bb.UR.y));
+       new_bb.LL = map_point(pointfof(bb.LL.x, bb.LL.y));
+       new_bb.UR = map_point(pointfof(bb.UR.x, bb.UR.y));
     }
     GD_bb(g) = new_bb;
     if (GD_label(g)) {
-       GD_label(g)->pos = map_pointf(GD_label(g)->pos);
+       GD_label(g)->pos = map_point(GD_label(g)->pos);
     }
     for (c = 1; c <= GD_n_cluster(g); c++)
        translate_bb(GD_clust(g)[c], rankdir);
@@ -185,7 +177,7 @@ static void translate_drawing(graph_t * g)
     for (v = agfstnode(g); v; v = agnxtnode(g, v)) {
        if (Rankdir) dot_nodesize(v, FALSE);
        if (shift) {
-           ND_coord_i(v) = map_point(ND_coord_i(v));
+           ND_coord(v) = map_point(ND_coord(v));
            if (State == GVSPLINES)
                for (e = agfstout(g, v); e; e = agnxtout(g, e))
                    map_edge(e);
index 5d2e64b18ebda4bd55a2d3c37f7db7b6c3b4ecc2..e970a31dab7c17d4fb25259d03456101e7340b61 100644 (file)
@@ -45,9 +45,6 @@ static int edgen;             /* size of edges[] */
 static void checkpath(int, boxf*, path*);
 static void mkspacep(int size);
 static void printpath(path * pp);
-#ifdef OBSOLETE
-static int append(path * path, int bi, point p0, point p1, int);
-#endif
 #ifdef DEBUG
 static void printboxes(int boxn, box* boxes)
 {
@@ -223,21 +220,6 @@ static int debugleveln(edge_t* realedge, int i)
 }
 #endif  /* DEBUG */
 
-#ifdef OBSOLETE
-static point mkpt(int x, int y)
-{
-    point rv;
-    rv.x = x;
-    rv.y = y;
-    return rv;
-}
-
-static int pteq(point p, point q)
-{
-    return ((p.x == q.x) && (p.y == q.y));
-}
-#endif
-
 /* routesplinesinit:
  * Data initialized once until matching call to routeplineterm
  * Allows recursive calls to dot
@@ -246,13 +228,6 @@ void
 routesplinesinit()
 {
     if (++routeinit > 1) return;
-#ifdef UNUSED
-    if (!(bs = N_GNEW(BINC, box))) {
-       agerr(AGERR, "cannot allocate bs\n");
-       abort();
-    }
-    maxbn = BINC;
-#endif
     if (!(ps = N_GNEW(PINC, pointf))) {
        agerr(AGERR, "cannot allocate ps\n");
        abort();
@@ -295,7 +270,7 @@ static pointf *_routesplines(path * pp, int *npoints, int polyline)
     Ppoint_t eps[2];
     Pvector_t evs[2];
     int edgei, prev, next;
-    point sp[4];
+    pointf sp[4];
     int pi, bi, si;
     double t;
     boxf *boxes;
@@ -340,7 +315,7 @@ static pointf *_routesplines(path * pp, int *npoints, int polyline)
     if ((boxn > 1) && (boxes[0].LL.y > boxes[1].LL.y)) {
         flip = 1;
        for (bi = 0; bi < boxn; bi++) {
-           int v = boxes[bi].UR.y;
+           double v = boxes[bi].UR.y;
            boxes[bi].UR.y = -1*boxes[bi].LL.y;
            boxes[bi].LL.y = -v;
        }
@@ -422,40 +397,9 @@ static pointf *_routesplines(path * pp, int *npoints, int polyline)
                polypoints[pi++].y = boxes[bi].LL.y;
            }
        }
-    } 
+    }
     else {
-#ifdef OBSOLETE
-       /* new, more generalized approach for self-edges.  We do not
-          assume any monotonicity about the box path, only that it
-          is simply connected.  We build up the constraint poly by
-          walking the box path from one end to the other and back
-          in the recursive function append(). A better approach to all
-          of this might be to dispense with the box paths altogether
-          and just compute the constraint poly directly, but this
-          needs to be done as part of a more thorough overhaul. */
-       point p0, p1;
-       box b0, b1;
-       b0 = pp->boxes[0];
-       b1 = pp->boxes[1];
-       /* determine 'starting' segment (side of b0) for box path search */
-       if (b0.UR.x == b1.LL.x) {
-           p0 = b0.LL;
-           p1 = mkpt(b0.LL.x, b0.UR.y);
-       } else if (b0.LL.y == b1.UR.y) {
-           p0 = mkpt(b0.LL.x, b0.UR.y);
-           p1 = b0.UR;
-       } else if (b0.LL.x == b1.UR.x) {
-           p0 = b0.UR;
-           p1 = mkpt(b0.UR.x, b0.LL.y);
-       } else if (b0.UR.y == b1.LL.y) {
-           p0 = mkpt(b0.UR.x, b0.LL.y);
-           p1 = b0.LL;
-       } else
-           abort();
-       pi = append(pp, 0, p0, p1, 0);
-#else
        abort();
-#endif
     }
 
     if (flip) {
@@ -521,17 +465,17 @@ static pointf *_routesplines(path * pp, int *npoints, int polyline)
        boxes[bi].UR.x = INT_MIN;
     }
     for (splinepi = 0; splinepi < spl.pn; splinepi++) {
-       P2PF(spl.ps[splinepi], ps[splinepi]);
+       ps[splinepi] = spl.ps[splinepi];
     }
 REDO:
     for (splinepi = 0; splinepi + 3 < spl.pn; splinepi += 3) {
        int num_div = delta * boxn;
        for (si = 0; si <= num_div; si++) {
            t = si / ((double)num_div);
-           PF2P(ps[splinepi], sp[0]);
-           PF2P(ps[splinepi + 1], sp[1]);
-           PF2P(ps[splinepi + 2], sp[2]);
-           PF2P(ps[splinepi + 3], sp[3]);
+           sp[0] = ps[splinepi];
+           sp[1] = ps[splinepi + 1];
+           sp[2] = ps[splinepi + 2];
+           sp[3] = ps[splinepi + 3];
            sp[0].x = sp[0].x + t * (sp[1].x - sp[0].x);
            sp[0].y = sp[0].y + t * (sp[1].y - sp[0].y);
            sp[1].x = sp[1].x + t * (sp[2].x - sp[1].x);
@@ -559,7 +503,7 @@ REDO:
      * Therefore, we make the sample finer until all boxes have
      * valid values. cf. bug 456. Would making sp[] pointfs help?
      */
-    for (bi = 0; bi < boxn; bi++) {
+    for (bi = 0; bi < boxn; bi++) {  /* FIXME - fp equality tests */
        if ((boxes[bi].LL.x == INT_MAX) || (boxes[bi].UR.x == INT_MIN)) {
            delta *= 2;
            goto REDO;
@@ -621,9 +565,9 @@ static void checkpath(int boxn, boxf* boxes, path* thepath)
     /* remove degenerate boxes. */
     i = 0;
     for (bi = 0; bi < boxn; bi++) {
-       if (boxes[bi].LL.y == boxes[bi].UR.y)
+       if (ABS(boxes[bi].LL.y - boxes[bi].UR.y) < .01)
            continue;
-       if (boxes[bi].LL.x == boxes[bi].UR.x)
+       if (ABS(boxes[bi].LL.x - boxes[bi].UR.x) < .01)
            continue;
        if (i != bi)
            boxes[i] = boxes[bi];
@@ -777,162 +721,6 @@ static void mkspacep(int size)
     }
 }
 
-#ifdef OBSOLETE
-/* new code to create poly from box list
- * given that we entered the box b on segment p0,p1 (p0==p1 allowed) 
- * then add successive points to the constraint poly
- */
-
-#define BOXLEFT 0
-#define BOXTOP 1
-#define BOXRIGHT 2
-#define BOXBOTTOM 3
-static box B;
-
-static int sideofB(point p, box B)
-{
-    if (p.x == B.LL.x)
-       return BOXLEFT;
-    if (p.y == B.UR.y)
-       return BOXTOP;
-    if (p.x == B.UR.x)
-       return BOXRIGHT;
-    if (p.y == B.LL.y)
-       return BOXBOTTOM;
-    abort();
-    return 0;
-}
-
-static int appendpt(point p, int polysz)
-{
-    polypoints[polysz].x = p.x;
-    polypoints[polysz].y = p.y;
-    return (polysz+1);
-}
-
-static int cmpf(const void *pp0, const void *pp1)
-{
-    point p0, p1;
-    int s0, s1;
-
-    p0 = *(point *) pp0;
-    p1 = *(point *) pp1;
-    s0 = sideofB(p0, B);
-    s1 = sideofB(p1, B);
-
-    if (s0 != s1)
-       return s1 - s0;
-    switch (s0) {
-    case BOXLEFT:
-       return p1.y - p0.y;
-    case BOXTOP:
-       return p1.x - p0.x;
-    case BOXRIGHT:
-       return p0.y - p1.y;
-    case BOXBOTTOM:
-       return p0.x - p1.x;
-    default:
-       abort();
-    }
-    return 0;                  /* not reached */
-}
-
-/* append:
- */
-static int 
-append(path * path, int bi, point p0, point p1, int polysz)
-{
-    point v[8];                /* worst case 4 corners + 2 segs * 2 points each */
-    point w[8];
-    box b = path->boxes[bi];
-    box bb;
-    int i, i0, npw, delta;
-    point q0 = { 0, 0 }, q1 = { 0, 0}, r;
-    int pn;
-
-    /* v = 4 corners of b, p0 and p1 */
-    pn = 0;
-    v[pn++] = b.LL;
-    v[pn++] = mkpt(b.UR.x, b.LL.y);
-    v[pn++] = b.UR;
-    v[pn++] = mkpt(b.LL.x, b.UR.y);
-    v[pn++] = p0;
-    v[pn++] = p1;
-
-    if (bi + 1 < path->nbox) {
-       bb = path->boxes[bi + 1];
-       /* determine points q0,q1 where b and bb touch and append to v */
-       if (b.UR.x == bb.LL.x) {
-           q0.x = q1.x = b.UR.x;
-           q0.y = MIN(b.UR.y, bb.UR.y);
-           q1.y = MAX(b.LL.y, bb.LL.y);
-       } else if (b.LL.x == bb.UR.x) {
-           q0.x = q1.x = b.LL.x;
-           q0.y = MIN(b.UR.y, bb.UR.y);
-           q1.y = MAX(b.LL.y, bb.LL.y);
-       } else if (b.UR.y == bb.LL.y) {
-           q0.y = q1.y = b.UR.y;
-           q0.x = MIN(b.UR.x, bb.UR.x);
-           q1.x = MAX(b.LL.x, bb.LL.x);
-       } else if (b.LL.y == bb.UR.y) {
-           q0.y = q1.y = b.LL.y;
-           q0.x = MIN(b.UR.x, bb.UR.x);
-           q1.x = MAX(b.LL.x, bb.LL.x);
-       } else
-           abort();
-       v[pn++] = q0;
-       v[pn++] = q1;
-    }
-
-    /* sort v so that the cyclic order is p0, all other points, p1  */
-    B = b;
-    qsort(v, pn, sizeof(v[0]), cmpf);
-
-    /* eliminate duplicates and record i0 = index of p0 in w */
-    w[0] = v[0];
-    npw = 1;
-    i0 = -1;
-    for (i = 0; i < pn; i++) {
-       if (pteq(w[npw - 1], p0))
-           i0 = npw - 1;
-       if (!pteq(v[i], w[npw - 1]))
-           w[npw++] = v[i];
-    }
-
-    i = i0;
-    if (bi == 0)
-       polysz = appendpt(p0, polysz);
-    if (pteq(p1, w[(i0 + 1) % npw]))
-       delta = -1;
-    else if (pteq(p1, w[(i0 - 1 + npw) % npw]))
-       delta = 1;
-    else
-       abort();
-    do {
-       i = (i + delta + npw) % npw;    /* go to the next point in order */
-       r = w[i];               /* call it r */
-
-       /* append r to current poly, except p0 and p1 are special cases */
-       if ((bi == 0) || (!pteq(r, p0) && !pteq(r, p1)))
-           polysz = appendpt(r, polysz);
-       if (pteq(r, p1))
-           break;
-       if (bi + 1 < path->nbox) {      /* recur when we hit the next box */
-           if (pteq(r, q0)) {
-               polysz = append(path, bi + 1, q0, q1, polysz);
-               polysz = appendpt(q1, polysz);  /* assumes q1 != p0 and p1 */
-               i += delta;     /* skip q1 */
-           } else if (pteq(r, q1)) {
-               polysz = append(path, bi + 1, q1, q0, polysz);
-               polysz = appendpt(q0, polysz);
-               i += delta;
-           }
-       }
-    } while (i != i0);
-    return polysz;
-}
-#endif
-
 static void printpath(path * pp)
 {
     int bi;
index f020842efe16319f09f8cb3985aed63d91fab9c0..51f3410fc96590accf2f3b8dbdd6f7665bed41fe 100644 (file)
@@ -347,15 +347,14 @@ static int stylenode(GVJ_t * job, node_t * n)
 static void Mcircle_hack(GVJ_t * job, node_t * n)
 {
     double x, y;
-    pointf AF[2], p, coord;
+    pointf AF[2], p;
 
     y = .7500;
     x = .6614;                 /* x^2 + y^2 = 1.0 */
     p.y = y * ND_ht_i(n) / 2.0;
     p.x = ND_rw_i(n) * x;      /* assume node is symmetric */
 
-    P2PF(ND_coord_i(n), coord);
-    AF[0] = add_pointfs(p, coord);
+    AF[0] = add_pointfs(p, ND_coord(n));
     AF[1].y = AF[0].y;
     AF[1].x = AF[0].x - 2 * p.x;
     gvrender_polyline(job, AF, 2);
@@ -1506,7 +1505,7 @@ static void poly_gencode(GVJ_t * job, node_t * n)
     }
 
     /* nominal label position in the center of the node */
-    P2PF(ND_coord_i(n), ND_label(n)->pos);
+    ND_label(n)->pos = ND_coord(n);
 
     xsize = (double)(ND_lw_i(n) + ND_rw_i(n)) / POINTS(ND_width(n));
     ysize = (double)ND_ht_i(n) / POINTS(ND_height(n));
@@ -1574,8 +1573,8 @@ static void poly_gencode(GVJ_t * job, node_t * n)
        /* get coords of innermost periphery */
        for (i = 0; i < sides; i++) {
            P = vertices[i];
-           AF[i].x = P.x * xsize + (double)ND_coord_i(n).x;
-           AF[i].y = P.y * ysize + (double)ND_coord_i(n).y;
+           AF[i].x = P.x * xsize + ND_coord(n).x;
+           AF[i].y = P.y * ysize + ND_coord(n).y;
        }
        /* lay down fill first */
        if (filled && pfilled) {
@@ -1597,8 +1596,8 @@ static void poly_gencode(GVJ_t * job, node_t * n)
     for (j = 0; j < peripheries; j++) {
        for (i = 0; i < sides; i++) {
            P = vertices[i + j * sides];
-           AF[i].x = P.x * xsize + (double)ND_coord_i(n).x;
-           AF[i].y = P.y * ysize + (double)ND_coord_i(n).y;
+           AF[i].x = P.x * xsize + ND_coord(n).x;
+           AF[i].y = P.y * ysize + ND_coord(n).y;
        }
        if (sides <= 2) {
            gvrender_ellipse(job, AF, sides, filled);
@@ -1786,8 +1785,8 @@ static void point_gencode(GVJ_t * job, node_t * n)
     for (j = 0; j < peripheries; j++) {
        for (i = 0; i < sides; i++) {
            P = vertices[i + j * sides];
-           AF[i].x = P.x + (double)ND_coord_i(n).x;
-           AF[i].y = P.y + (double)ND_coord_i(n).y;
+           AF[i].x = P.x + ND_coord(n).x;
+           AF[i].y = P.y + ND_coord(n).y;
        }
        gvrender_ellipse(job, AF, sides, filled);
        /* fill innermost periphery only */
@@ -2246,7 +2245,7 @@ record_inside(inside_t * inside_context, pointf p)
 static int record_path(node_t* n, port* prt, int side, boxf rv[], int *kptr)
 {
     int i, ls, rs;
-    pointf p, np;
+    pointf p;
     field_t *info;
 
     if (!prt->defined) return 0;
@@ -2264,14 +2263,13 @@ static int record_path(node_t* n, port* prt, int side, boxf rv[], int *kptr)
        if (BETWEEN(ls, p.x, rs)) {
            /* FIXME: I don't understand this code */
            if (GD_flip(n->graph)) {
-               P2PF(ND_coord_i(n), np);
-               rv[0] = flip_rec_boxf(info->fld[i]->b, np);
+               rv[0] = flip_rec_boxf(info->fld[i]->b, ND_coord(n));
            } else {
-               rv[0].LL.x = ND_coord_i(n).x + ls;
-               rv[0].LL.y = ND_coord_i(n).y - ND_ht_i(n) / 2.;
-               rv[0].UR.x = ND_coord_i(n).x + rs;
+               rv[0].LL.x = ND_coord(n).x + ls;
+               rv[0].LL.y = ND_coord(n).y - (ND_ht_i(n) / 2);
+               rv[0].UR.x = ND_coord(n).x + rs;
            }
-           rv[0].UR.y = ND_coord_i(n).y + ND_ht_i(n) / 2;
+           rv[0].UR.y = ND_coord(n).y + (ND_ht_i(n) / 2);
            *kptr = 1;
            break;
        }
@@ -2285,8 +2283,8 @@ static void gen_fields(GVJ_t * job, node_t * n, field_t * f)
     pointf AF[2], coord;
 
     if (f->lp) {
-       coord.x = (f->b.LL.x + f->b.UR.x) / 2.0 + ND_coord_i(n).x;
-       coord.y = (f->b.LL.y + f->b.UR.y) / 2.0 + ND_coord_i(n).y;
+       coord.x = (f->b.LL.x + f->b.UR.x) / 2. + ND_coord(n).x;
+       coord.y = (f->b.LL.y + f->b.UR.y) / 2. + ND_coord(n).y;
        f->lp->pos = coord;
        emit_label(job, EMIT_NLABEL, f->lp);
         pencolor(job, n);
@@ -2295,15 +2293,15 @@ static void gen_fields(GVJ_t * job, node_t * n, field_t * f)
     for (i = 0; i < f->n_flds; i++) {
        if (i > 0) {
            if (f->LR) {
-               P2PF(f->fld[i]->b.LL, AF[0]);
+               AF[0] = f->fld[i]->b.LL;
                AF[1].x = AF[0].x;
-               AF[1].y = (double)(f->fld[i]->b.UR.y);
+               AF[1].y = f->fld[i]->b.UR.y;
            } else {
-               P2PF(f->fld[i]->b.UR, AF[1]);
-               AF[0].x = (double)(f->fld[i]->b.LL.x);
+               AF[1] = f->fld[i]->b.UR;
+               AF[0].x = f->fld[i]->b.LL.x;
                AF[0].y = AF[1].y;
            }
-           P2PF(ND_coord_i(n), coord);
+           coord = ND_coord(n);
            AF[0] = add_pointfs(AF[0], coord);
            AF[1] = add_pointfs(AF[1], coord);
            gvrender_polyline(job, AF, 2);
@@ -2322,11 +2320,11 @@ static void record_gencode(GVJ_t * job, node_t * n)
     int doMap = (obj->url || obj->explicit_tooltip);
 
     f = (field_t *) ND_shape_info(n);
-    B2BF(f->b, BF);
-    BF.LL.x += (double)(ND_coord_i(n).x);
-    BF.LL.y += (double)(ND_coord_i(n).y);
-    BF.UR.x += (double)(ND_coord_i(n).x);
-    BF.UR.y += (double)(ND_coord_i(n).y);
+    BF = f->b;
+    BF.LL.x += ND_coord(n).x;
+    BF.LL.y += ND_coord(n).y;
+    BF.UR.x += ND_coord(n).x;
+    BF.UR.y += ND_coord(n).y;
     
     if (doMap && !(job->flags & EMIT_CLUSTERS_LAST))
         gvrender_begin_anchor(job, obj->url, obj->tooltip, obj->target);
@@ -2440,10 +2438,10 @@ static void epsf_gencode(GVJ_t * job, node_t * n)
     gvrender_begin_context(job);
     if (desc)
        fprintf(job->output_file,
-               "%d %d translate newpath user_shape_%d\n",
-               ND_coord_i(n).x + desc->offset.x,
-               ND_coord_i(n).y + desc->offset.y, desc->macro_id);
-    P2PF(ND_coord_i(n), ND_label(n)->pos);
+               "%.3g %.3g translate newpath user_shape_%d\n",
+               ND_coord(n).x + desc->offset.x,
+               ND_coord(n).y + desc->offset.y, desc->macro_id);
+    ND_label(n)->pos = ND_coord(n);
     gvrender_end_context(job);
 
     emit_label(job, EMIT_NLABEL, ND_label(n));
@@ -2457,9 +2455,10 @@ static void epsf_gencode(GVJ_t * job, node_t * n)
 static char* side_port[] = {"s", "e", "n", "w"};
 
 static point
-cvtPt (point p, int rankdir)
+cvtPt (pointf p, int rankdir)
 {
-    point q = {0, 0};
+    pointf q = {0, 0};
+    point Q;
 
     switch (rankdir) {
     case RANKDIR_TB :
@@ -2478,7 +2477,8 @@ cvtPt (point p, int rankdir)
        q.x = p.y;
        break;
     }
-    return q;
+    PF2P(q, Q);
+    return Q;
 }
 
 static char* closestSide (node_t*  n, node_t* other, port* oldport)
@@ -2486,8 +2486,8 @@ static char* closestSide (node_t*  n, node_t* other, port* oldport)
     boxf b;
     int rkd = GD_rankdir(n->graph->root);
     point p = {0, 0};
-    point pt = cvtPt (ND_coord_i(n), rkd);
-    point opt = cvtPt (ND_coord_i(other), rkd);
+    point pt = cvtPt (ND_coord(n), rkd);
+    point opt = cvtPt (ND_coord(other), rkd);
     int sides = oldport->side;
     char* rv = NULL;
     int i, d, mind = 0;
index 4095273ec89fa35f49298f0d158aa4920c1ce07b..a50c92d63e7af28649e558a6ab896646ab7d7f77 100644 (file)
@@ -159,16 +159,16 @@ shape_clip0(inside_t * inside_context, node_t * n, pointf curve[4],
 
     save_real_size = ND_rw_i(n);
     for (i = 0; i < 4; i++) {
-       c[i].x = curve[i].x - ND_coord_i(n).x;
-       c[i].y = curve[i].y - ND_coord_i(n).y;
+       c[i].x = curve[i].x - ND_coord(n).x;
+       c[i].y = curve[i].y - ND_coord(n).y;
     }
 
     bezier_clip(inside_context, ND_shape(n)->fns->insidefn, c,
                left_inside);
 
     for (i = 0; i < 4; i++) {
-       curve[i].x = c[i].x + ND_coord_i(n).x;
-       curve[i].y = c[i].y + ND_coord_i(n).y;
+       curve[i].x = c[i].x + ND_coord(n).x;
+       curve[i].y = c[i].y + ND_coord(n).y;
     }
     ND_rw_i(n) = save_real_size;
 }
@@ -198,8 +198,8 @@ void shape_clip(node_t * n, pointf curve[4])
     inside_context.s.n = n;
     inside_context.s.bp = NULL;
     save_real_size = ND_rw_i(n);
-    c.x = curve[0].x - ND_coord_i(n).x;
-    c.y = curve[0].y - ND_coord_i(n).y;
+    c.x = curve[0].x - ND_coord(n).x;
+    c.y = curve[0].y - ND_coord(n).y;
     left_inside = ND_shape(n)->fns->insidefn(&inside_context, c);
     ND_rw_i(n) = save_real_size;
     shape_clip0(&inside_context, n, curve, left_inside);
@@ -274,8 +274,8 @@ clip_and_install(edge_t * fe, node_t * hn, pointf * ps, int pn,
        inside_context.s.n = tn;
        inside_context.s.bp = tbox;
        for (start = 0; start < pn - 4; start += 3) {
-           p2.x = ps[start + 3].x - ND_coord_i(tn).x;
-           p2.y = ps[start + 3].y - ND_coord_i(tn).y;
+           p2.x = ps[start + 3].x - ND_coord(tn).x;
+           p2.y = ps[start + 3].y - ND_coord(tn).y;
            if (ND_shape(tn)->fns->insidefn(&inside_context, p2) == FALSE)
                break;
        }
@@ -286,8 +286,8 @@ clip_and_install(edge_t * fe, node_t * hn, pointf * ps, int pn,
        inside_context.s.n = hn;
        inside_context.s.bp = hbox;
        for (end = pn - 4; end > 0; end -= 3) {
-           p2.x = ps[end].x - ND_coord_i(hn).x;
-           p2.y = ps[end].y - ND_coord_i(hn).y;
+           p2.x = ps[end].x - ND_coord(hn).x;
+           p2.y = ps[end].y - ND_coord(hn).y;
            if (ND_shape(hn)->fns->insidefn(&inside_context, p2) == FALSE)
                break;
        }
@@ -331,14 +331,14 @@ conc_slope(node_t* n)
 
     s_in = s_out = 0.0;
     for (cnt_in = 0; (e = ND_in(n).list[cnt_in]); cnt_in++)
-       s_in += ND_coord_i(e->tail).x;
+       s_in += ND_coord(e->tail).x;
     for (cnt_out = 0; (e = ND_out(n).list[cnt_out]); cnt_out++)
-       s_out += ND_coord_i(e->head).x;
-    p.x = ND_coord_i(n).x - (s_in / cnt_in);
-    p.y = ND_coord_i(n).y - ND_coord_i(ND_in(n).list[0]->tail).y;
+       s_out += ND_coord(e->head).x;
+    p.x = ND_coord(n).x - (s_in / cnt_in);
+    p.y = ND_coord(n).y - ND_coord(ND_in(n).list[0]->tail).y;
     m_in = atan2(p.y, p.x);
-    p.x = (s_out / cnt_out) - ND_coord_i(n).x;
-    p.y = ND_coord_i(ND_out(n).list[0]->head).y - ND_coord_i(n).y;
+    p.x = (s_out / cnt_out) - ND_coord(n).x;
+    p.y = ND_coord(ND_out(n).list[0]->head).y - ND_coord(n).y;
     m_out = atan2(p.y, p.x);
     return ((m_in + m_out) / 2.0);
 }
@@ -386,7 +386,6 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
 {
     int side, mask;
     node_t *n;
-    pointf np;
     int (*pboxfn) (node_t*, port*, int, boxf*, int*);
 
     n = e->tail;
@@ -397,8 +396,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        pboxfn = ND_shape(n)->fns->pboxfn;
     else
        pboxfn = NULL;
-    P2PF(ND_coord_i(n), np);
-    P->start.p = add_pointfs(np, ED_tail_port(e).p);
+    P->start.p = add_pointfs(ND_coord(n), ED_tail_port(e).p);
     if (merge) {
        /*P->start.theta = - M_PI / 2; */
        P->start.theta = conc_slope(e->tail);
@@ -418,15 +416,15 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        boxf b0, b = endp->nb;
        if (side & TOP) {
            endp->sidemask = TOP;
-           if (P->start.p.x < ND_coord_i(n).x) { /* go left */
+           if (P->start.p.x < ND_coord(n).x) { /* go left */
                b0.LL.x = b.LL.x - 1;
-               /* b0.LL.y = ND_coord_i(n).y + ND_ht_i(n)/2; */
+               /* b0.LL.y = ND_coord(n).y + ND_ht_i(n)/2; */
                b0.LL.y = P->start.p.y;
                b0.UR.x = b.UR.x;
-               b0.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2 + GD_ranksep(n->graph)/2;
-               b.UR.x = ND_coord_i(n).x - ND_lw_i(n) - (FUDGE-2);
+               b0.UR.y = ND_coord(n).y + ND_ht_i(n)/2 + GD_ranksep(n->graph)/2;
+               b.UR.x = ND_coord(n).x - ND_lw_i(n) - (FUDGE-2);
                b.UR.y = b0.LL.y;
-               b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
                b.LL.x -= 1;
                endp->boxes[0] = b0;
                endp->boxes[1] = b;
@@ -434,12 +432,12 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            else {
                b0.LL.x = b.LL.x;
                b0.LL.y = P->start.p.y;
-               /* b0.LL.y = ND_coord_i(n).y + ND_ht_i(n)/2; */
+               /* b0.LL.y = ND_coord(n).y + ND_ht_i(n)/2; */
                b0.UR.x = b.UR.x+1;
-               b0.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2 + GD_ranksep(n->graph)/2;
-               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + (FUDGE-2);
+               b0.UR.y = ND_coord(n).y + ND_ht_i(n)/2 + GD_ranksep(n->graph)/2;
+               b.LL.x = ND_coord(n).x + ND_rw_i(n) + (FUDGE-2);
                b.UR.y = b0.LL.y;
-               b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
                b.UR.x += 1;
                endp->boxes[0] = b0;
                endp->boxes[1] = b;
@@ -457,7 +455,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        else if (side & LEFT) {
            endp->sidemask = LEFT;
            b.UR.x = P->start.p.x;
-           b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+           b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
            b.UR.y = P->start.p.y;
            endp->boxes[0] = b;
            endp->boxn = 1;
@@ -466,7 +464,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        else {
            endp->sidemask = RIGHT;
            b.LL.x = P->start.p.x;
-           b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+           b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
            b.UR.y = P->start.p.y;
            endp->boxes[0] = b;
            endp->boxn = 1;
@@ -489,13 +487,13 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        }
        else if (side & BOTTOM) {
            if (endp->sidemask == TOP) {
-               b0.UR.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b0.UR.y = ND_coord(n).y - ND_ht_i(n)/2;
                b0.UR.x = b.UR.x+1;
                b0.LL.x = P->start.p.x;
                b0.LL.y = b0.UR.y - GD_ranksep(n->graph)/2;
-               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + (FUDGE-2);
+               b.LL.x = ND_coord(n).x + ND_rw_i(n) + (FUDGE-2);
                b.LL.y = b0.UR.y;
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.UR.x += 1;
                endp->boxes[0] = b0;
                endp->boxes[1] = b;
@@ -510,11 +508,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        else if (side & LEFT) {
            b.UR.x = P->start.p.x+1;
            if (endp->sidemask == TOP) {
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.LL.y = P->start.p.y-1;
            }
            else {
-               b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
                b.UR.y = P->start.p.y+1;
            }
            endp->boxes[0] = b;
@@ -523,11 +521,11 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        else {
            b.LL.x = P->start.p.x;
            if (endp->sidemask == TOP) {
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.LL.y = P->start.p.y;
            }
            else {
-               b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
                b.UR.y = P->start.p.y+1;
            }
            endp->boxes[0] = b;
@@ -579,7 +577,6 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
 {
     int side, mask;
     node_t *n;
-    pointf np;
     int (*pboxfn) (node_t* n, port*, int, boxf*, int*);
 
     n = e->head;
@@ -590,8 +587,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        pboxfn = ND_shape(n)->fns->pboxfn;
     else
        pboxfn = NULL;
-    P2PF(ND_coord_i(n), np);
-    P->end.p = add_pointfs(np, ED_head_port(e).p);
+    P->end.p = add_pointfs(ND_coord(n), ED_head_port(e).p);
     if (merge) {
        /*P->end.theta = M_PI / 2; */
        P->end.theta = conc_slope(e->head) + M_PI;
@@ -617,15 +613,15 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        }
        else if (side & BOTTOM) {
            endp->sidemask = BOTTOM;
-           if (P->end.p.x < ND_coord_i(n).x) { /* go left */
+           if (P->end.p.x < ND_coord(n).x) { /* go left */
                b0.LL.x = b.LL.x-1;
-               /* b0.UR.y = ND_coord_i(n).y - ND_ht_i(n)/2; */
+               /* b0.UR.y = ND_coord(n).y - ND_ht_i(n)/2; */
                b0.UR.y = P->end.p.y;
                b0.UR.x = b.UR.x;
-               b0.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2 - GD_ranksep(n->graph)/2;
-               b.UR.x = ND_coord_i(n).x - ND_lw_i(n) - (FUDGE-2);
+               b0.LL.y = ND_coord(n).y - ND_ht_i(n)/2 - GD_ranksep(n->graph)/2;
+               b.UR.x = ND_coord(n).x - ND_lw_i(n) - (FUDGE-2);
                b.LL.y = b0.UR.y;
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.LL.x -= 1;
                endp->boxes[0] = b0;
                endp->boxes[1] = b;
@@ -633,12 +629,12 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            else {
                b0.LL.x = b.LL.x;
                b0.UR.y = P->end.p.y;
-               /* b0.UR.y = ND_coord_i(n).y - ND_ht_i(n)/2; */
+               /* b0.UR.y = ND_coord(n).y - ND_ht_i(n)/2; */
                b0.UR.x = b.UR.x+1;
-               b0.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2 - GD_ranksep(n->graph)/2;
-               b.LL.x = ND_coord_i(n).x + ND_rw_i(n) + (FUDGE-2);
+               b0.LL.y = ND_coord(n).y - ND_ht_i(n)/2 - GD_ranksep(n->graph)/2;
+               b.LL.x = ND_coord(n).x + ND_rw_i(n) + (FUDGE-2);
                b.LL.y = b0.UR.y;
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.UR.x += 1;
                endp->boxes[0] = b0;
                endp->boxes[1] = b;
@@ -649,7 +645,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        else if (side & LEFT) {
            endp->sidemask = LEFT;
            b.UR.x = P->end.p.x;
-           b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+           b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
            b.LL.y = P->end.p.y;
            endp->boxes[0] = b;
            endp->boxn = 1;
@@ -658,7 +654,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        else {
            endp->sidemask = RIGHT;
            b.LL.x = P->end.p.x;
-           b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+           b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
            b.LL.y = P->end.p.y;
            endp->boxes[0] = b;
            endp->boxn = 1;
@@ -680,11 +676,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        case LEFT:
            b.UR.x = P->end.p.x;
            if (endp->sidemask == TOP) {
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.LL.y = P->end.p.y;
            }
            else {
-               b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
                b.UR.y = P->end.p.y;
            }
            endp->boxes[0] = b;
@@ -693,11 +689,11 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        case RIGHT:
            b.LL.x = P->end.p.x-1;
            if (endp->sidemask == TOP) {
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.LL.y = P->end.p.y-1;
            }
            else {
-               b.LL.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b.LL.y = ND_coord(n).y - ND_ht_i(n)/2;
                b.UR.y = P->end.p.y;
            }
            endp->boxes[0] = b;
@@ -711,12 +707,12 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
        case BOTTOM:
            if (endp->sidemask == TOP) {
                b0.LL.x = b.LL.x-1;
-               b0.UR.y = ND_coord_i(n).y - ND_ht_i(n)/2;
+               b0.UR.y = ND_coord(n).y - ND_ht_i(n)/2;
                b0.UR.x = P->end.p.x;
                b0.LL.y = b0.UR.y - GD_ranksep(n->graph)/2;
-               b.UR.x = ND_coord_i(n).x - ND_lw_i(n) - 2;
+               b.UR.x = ND_coord(n).x - ND_lw_i(n) - 2;
                b.LL.y = b0.UR.y;
-               b.UR.y = ND_coord_i(n).y + ND_ht_i(n)/2;
+               b.UR.y = ND_coord(n).y + ND_ht_i(n)/2;
                b.LL.x -= 1;
                endp->boxes[0] = b0;
                endp->boxes[1] = b;
@@ -787,7 +783,7 @@ static void selfBottom (edge_t* edges[], int ind, int cnt,
     stepx = (sizex / 2.) / cnt;
     stepx = MAX(stepx,2.);
     pointn = 0;
-    P2PF(ND_coord_i(n), np);
+    np = ND_coord(n);
     tp = ED_tail_port(e).p;
     tp.x += np.x;
     tp.y += np.y;
@@ -818,8 +814,8 @@ static void selfBottom (edge_t* edges[], int ind, int cnt,
            width = ED_label(e)->dimen.x;
            height = ED_label(e)->dimen.y;
        }
-       ED_label(e)->pos.y = ND_coord_i(n).y - dy - height / 2.0;
-       ED_label(e)->pos.x = ND_coord_i(n).x;
+       ED_label(e)->pos.y = ND_coord(n).y - dy - height / 2.0;
+       ED_label(e)->pos.x = ND_coord(n).x;
        ED_label(e)->set = TRUE;
        if (height > stepy)
            dy += height - stepy;
@@ -853,7 +849,7 @@ selfTop (edge_t* edges[], int ind, int cnt, double sizex, double stepy,
     stepx = (sizex / 2.) / cnt;
     stepx = MAX(stepx, 2.);
     pointn = 0;
-    P2PF(ND_coord_i(n), np);
+    np = ND_coord(n);
     tp = ED_tail_port(e).p;
     tp.x += np.x;
     tp.y += np.y;
@@ -884,8 +880,8 @@ selfTop (edge_t* edges[], int ind, int cnt, double sizex, double stepy,
                width = ED_label(e)->dimen.x;
                height = ED_label(e)->dimen.y;
            }
-           ED_label(e)->pos.y = ND_coord_i(n).y + dy + height / 2.0;
-           ED_label(e)->pos.x = ND_coord_i(n).x;
+           ED_label(e)->pos.y = ND_coord(n).y + dy + height / 2.0;
+           ED_label(e)->pos.x = ND_coord(n).x;
            ED_label(e)->set = TRUE;
            if (height > stepy)
                dy += height - stepy;
@@ -919,7 +915,7 @@ selfRight (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
     stepy = (sizey / 2.) / cnt;
     stepy = MAX(stepy, 2.);
     pointn = 0;
-    P2PF(ND_coord_i(n), np);
+    np = ND_coord(n);
     tp = ED_tail_port(e).p;
     tp.x += np.x;
     tp.y += np.y;
@@ -950,8 +946,8 @@ selfRight (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
                width = ED_label(e)->dimen.x;
                height = ED_label(e)->dimen.y;
            }
-           ED_label(e)->pos.x = ND_coord_i(n).x + dx + width / 2.0;
-           ED_label(e)->pos.y = ND_coord_i(n).y;
+           ED_label(e)->pos.x = ND_coord(n).x + dx + width / 2.0;
+           ED_label(e)->pos.y = ND_coord(n).y;
            ED_label(e)->set = TRUE;
            if (width > stepx)
                dx += width - stepx;
@@ -985,7 +981,7 @@ selfLeft (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
     stepy = (sizey / 2.) / cnt;
     stepy = MAX(stepy,2.);
     pointn = 0;
-    P2PF(ND_coord_i(n), np);
+    np = ND_coord(n);
     tp = ED_tail_port(e).p;
     tp.x += np.x;
     tp.y += np.y;
@@ -1016,8 +1012,8 @@ selfLeft (edge_t* edges[], int ind, int cnt, double stepx, double sizey,
            width = ED_label(e)->dimen.x;
            height = ED_label(e)->dimen.y;
        }
-       ED_label(e)->pos.x = ND_coord_i(n).x - dx - width / 2.0;
-       ED_label(e)->pos.y = ND_coord_i(n).y;
+       ED_label(e)->pos.x = ND_coord(n).x - dx - width / 2.0;
+       ED_label(e)->pos.y = ND_coord(n).y;
        ED_label(e)->set = TRUE;
        if (width > stepx)
            dx += width - stepx;
index d2bcf4be9bfdfea77054069db31b18ba10ebf073..c428843fd9ef596afa9ad1956efbd80f440e6dd4 100644 (file)
@@ -430,7 +430,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
     typedef struct Agnodeinfo_t {
        shape_desc *shape;
        void *shape_info;
-       point coord;
+       pointf coord;
        double width, height;
        boxf bb;
        int ht, lw, rw;
@@ -483,7 +483,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
 #define ND_alg(n) (n)->u.alg
 #define ND_bb(n) (n)->u.bb
 #define ND_clust(n) (n)->u.clust
-#define ND_coord_i(n) (n)->u.coord
+#define ND_coord(n) (n)->u.coord
 #define ND_dist(n) (n)->u.dist
 #define ND_flat_in(n) (n)->u.flat_in
 #define ND_flat_out(n) (n)->u.flat_out
index e24691da4d9cb3a24372b8eec87c053939eca405..8a26215490e7f3814be67708e5547902574f591f 100644 (file)
@@ -1420,7 +1420,7 @@ boolean overlap_node(node_t *n, boxf b)
     if (! OVERLAP(b, bb))
         return FALSE;
 
-    P2PF(ND_coord_i(n),p);
+    p = ND_coord(n);
 
 /*  FIXME - need to do something better about CLOSEENOUGH */
     p.x -= (b.UR.x + b.LL.x) / 2.;
index 7f0a30a6ff5a08615050f22754680622864c5a39..34fc44dd9b2541f130ca084d623511f11ba35a0d 100644 (file)
@@ -373,7 +373,7 @@ static void makeCompoundEdge(graph_t * g, edge_t * e)
     fixed = 0;
     if (lh) {
        bb = &(GD_bb(lh));
-       if (!inBox(ND_coord_i(head), bb)) {
+       if (!inBoxf(ND_coord(head), bb)) {
            agerr(AGWARN, "%s -> %s: head not inside head cluster %s\n",
                  e->tail->name, e->head->name, agget(e, "lhead"));
        } else {
@@ -383,7 +383,7 @@ static void makeCompoundEdge(graph_t * g, edge_t * e)
             * crosses box.
             */
            if (inBoxf(bez->list[0], bb)) {
-               if (inBox(ND_coord_i(tail), bb)) {
+               if (inBoxf(ND_coord(tail), bb)) {
                    agerr(AGWARN,
                          "%s -> %s: tail is inside head cluster %s\n",
                          e->tail->name, e->head->name, agget(e, "lhead"));
@@ -433,7 +433,7 @@ static void makeCompoundEdge(graph_t * g, edge_t * e)
     fixed = 0;
     if (lt) {
        bb = &(GD_bb(lt));
-       if (!inBox(ND_coord_i(tail), bb)) {
+       if (!inBoxf(ND_coord(tail), bb)) {
            agerr(AGWARN, "%s -> %s: tail not inside tail cluster %s\n",
                  e->tail->name, head->name, agget(e, "ltail"));
        } else {
@@ -443,7 +443,7 @@ static void makeCompoundEdge(graph_t * g, edge_t * e)
             * arrow head crosses box.
             */
            if (inBoxf(bez->list[endi], bb)) {
-               if (inBox(ND_coord_i(head), bb)) {
+               if (inBoxf(ND_coord(head), bb)) {
                    agerr(AGWARN,
                          "%s -> %s: head is inside tail cluster %s\n",
                          e->tail->name, e->head->name, agget(e, "ltail"));
index 13aa8882f5b7359b5e5df2bfef740c0c56b3fa67..9515474cb524ed86f56acfd69e5585c7cad76e51 100644 (file)
@@ -50,7 +50,6 @@
        ED_to_orig(newp) = old; \
 }
 
-#define P2PF(p, pf) (pf.x = p.x, pf.y = p.y)
 #define AVG(a, b) ((a + b) / 2)
 
 static boxf boxes[1000];
@@ -236,9 +235,9 @@ static void _dot_splines(graph_t * g, int normalize)
     for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
        n_nodes += GD_rank(g)[i].n;
        if ((n = GD_rank(g)[i].v[0]))
-           sd.LeftBound = MIN(sd.LeftBound, (ND_coord_i(n).x - ND_lw_i(n)));
+           sd.LeftBound = MIN(sd.LeftBound, (ND_coord(n).x - ND_lw_i(n)));
        if (GD_rank(g)[i].n && (n = GD_rank(g)[i].v[GD_rank(g)[i].n - 1]))
-           sd.RightBound = MAX(sd.RightBound, (ND_coord_i(n).x + ND_rw_i(n)));
+           sd.RightBound = MAX(sd.RightBound, (ND_coord(n).x + ND_rw_i(n)));
        sd.LeftBound -= MINW;
        sd.RightBound += MINW;
 
@@ -250,7 +249,7 @@ static void _dot_splines(graph_t * g, int normalize)
            if (ND_alg(n)) {
                edge_t* fe = (edge_t*)ND_alg(n);
                assert (ED_label(fe));
-               P2PF(ND_coord_i(n), ED_label(fe)->pos);
+               ED_label(fe)->pos = ND_coord(n);
            }
            if ((ND_node_type(n) != NORMAL) &&
                (sinfo.splineMerge(n) == FALSE))
@@ -350,16 +349,16 @@ static void _dot_splines(graph_t * g, int normalize)
            r = ND_rank(n);
            if (r == GD_maxrank(g)) {
                if (r > 0)
-                   sizey = ND_coord_i(GD_rank(g)[r-1].v[0]).y - ND_coord_i(n).y;
+                   sizey = ND_coord(GD_rank(g)[r-1].v[0]).y - ND_coord(n).y;
                else
                    sizey = ND_ht_i(n);
            }
            else if (r == GD_minrank(g)) {
-               sizey = ND_coord_i(n).y - ND_coord_i(GD_rank(g)[r+1].v[0]).y;
+               sizey = ND_coord(n).y - ND_coord(GD_rank(g)[r+1].v[0]).y;
            }
            else {
-               int upy = ND_coord_i(GD_rank(g)[r-1].v[0]).y - ND_coord_i(n).y;
-               int dwny = ND_coord_i(n).y - ND_coord_i(GD_rank(g)[r+1].v[0]).y;
+               int upy = ND_coord(GD_rank(g)[r-1].v[0]).y - ND_coord(n).y;
+               int dwny = ND_coord(n).y - ND_coord(GD_rank(g)[r+1].v[0]).y;
                sizey = MIN(upy, dwny);
            }
            makeSelfEdge(P, edges, ind, cnt, sd.Multisep, sizey/2, &sinfo);
@@ -453,8 +452,8 @@ place_vnlabel(node_t * n)
         e = ED_to_orig(e));
     dimen = ED_label(e)->dimen;
     width = GD_flip(n->graph) ? dimen.y : dimen.x;
-    ED_label(e)->pos.x = ND_coord_i(n).x + width / 2.0;
-    ED_label(e)->pos.y = ND_coord_i(n).y;
+    ED_label(e)->pos.x = ND_coord(n).x + width / 2.0;
+    ED_label(e)->pos.y = ND_coord(n).y;
 }
 
 static void 
@@ -516,8 +515,8 @@ static int edgecmp(edge_t** ptr0, edge_t** ptr1)
     v1 = ND_rank(le1->tail) - ND_rank(le1->head), v1 = ABS(v1);
     if (v0 != v1)
        return (v0 - v1);
-    v0 = ND_coord_i(le0->tail).x - ND_coord_i(le0->head).x, v0 = ABS(v0);
-    v1 = ND_coord_i(le1->tail).x - ND_coord_i(le1->head).x, v1 = ABS(v1);
+    v0 = ND_coord(le0->tail).x - ND_coord(le0->head).x, v0 = ABS(v0);
+    v1 = ND_coord(le1->tail).x - ND_coord(le1->head).x, v1 = ABS(v1);
     if (v0 != v1)
        return (v0 - v1);
     /* This provides a cheap test for edges having the same set of endpoints.
@@ -686,15 +685,12 @@ static void
 makeSimpleFlat (node_t* tn, node_t* hn, edge_t** edges, int ind, int cnt, int et)
 {
     edge_t* e = edges[ind];
-    pointf points[10], np, tp, hp;
+    pointf points[10], tp, hp;
     int i, pointn;
     double stepy, dy;
 
-    P2PF(ND_coord_i(tn), np);
-    tp = add_pointfs(np, ED_tail_port(e).p);
-
-    P2PF(ND_coord_i(hn), np);
-    hp = add_pointfs(np, ED_head_port(e).p);
+    tp = add_pointfs(ND_coord(tn), ED_tail_port(e).p);
+    hp = add_pointfs(ND_coord(hn), ED_head_port(e).p);
 
     stepy = (cnt > 1) ? ND_ht_i(tn) / (double)(cnt - 1) : 0.;
     dy = tp.y - ((cnt > 1) ? ND_ht_i(tn) / 2. : 0.);
@@ -765,8 +761,8 @@ make_flat_adj_edges(path* P, edge_t** edges, int ind, int cnt, edge_t* e0,
     auxg = cloneGraph (g);
     subg = agsubg (auxg, "xxx");
     agset (subg, "rank", "source");
-    rightx = ND_coord_i(hn).x;
-    leftx = ND_coord_i(tn).x;
+    rightx = ND_coord(hn).x;
+    leftx = ND_coord(tn).x;
     if (GD_flip(g)) {
         node_t* n;
         n = tn;
@@ -800,18 +796,18 @@ make_flat_adj_edges(path* P, edge_t** edges, int ind, int cnt, edge_t* e0,
     dot_position(auxg);
     
     /* reposition */
-    midx = (ND_coord_i(tn).x - ND_rw_i(tn) + ND_coord_i(hn).x + ND_lw_i(hn))/2;
-    midy = (ND_coord_i(auxt).x + ND_coord_i(auxh).x)/2;
+    midx = (ND_coord(tn).x - ND_rw_i(tn) + ND_coord(hn).x + ND_lw_i(hn))/2;
+    midy = (ND_coord(auxt).x + ND_coord(auxh).x)/2;
     for (n = GD_nlist(auxg); n; n = ND_next(n)) {
        if (n == auxt) {
-           ND_coord_i(n).y = rightx;
-           ND_coord_i(n).x = midy;
+           ND_coord(n).y = rightx;
+           ND_coord(n).x = midy;
        }
        else if (n == auxh) {
-           ND_coord_i(n).y = leftx;
-           ND_coord_i(n).x = midy;
+           ND_coord(n).y = leftx;
+           ND_coord(n).x = midy;
        }
-       else ND_coord_i(n).y = midx;
+       else ND_coord(n).y = midx;
     }
     dot_sameports(auxg);
     _dot_splines(auxg, 0);
@@ -819,12 +815,12 @@ make_flat_adj_edges(path* P, edge_t** edges, int ind, int cnt, edge_t* e0,
 
        /* copy splines */
     if (GD_flip(g)) {
-       del.x = ND_coord_i(tn).x - ND_coord_i(auxt).y;
-       del.y = ND_coord_i(tn).y + ND_coord_i(auxt).x;
+       del.x = ND_coord(tn).x - ND_coord(auxt).y;
+       del.y = ND_coord(tn).y + ND_coord(auxt).x;
     }
     else {
-       del.x = ND_coord_i(tn).x - ND_coord_i(auxt).x;
-       del.y = ND_coord_i(tn).y - ND_coord_i(auxt).y;
+       del.x = ND_coord(tn).x - ND_coord(auxt).x;
+       del.y = ND_coord(tn).y - ND_coord(auxt).y;
     }
     for (i = 0; i < cnt; i++) {
        bezier* auxbz;
@@ -884,7 +880,7 @@ makeFlatEnd (spline_info_t* sp, path* P, node_t* n, edge_t* e, pathend_t* endp,
     else endpath(P, e, FLATEDGE, endp, FALSE);
     b.UR.y = endp->boxes[endp->boxn - 1].UR.y;
     b.LL.y = endp->boxes[endp->boxn - 1].LL.y;
-    b = makeregularend(b, TOP, ND_coord_i(n).y + GD_rank(g)[ND_rank(n)].ht2);
+    b = makeregularend(b, TOP, ND_coord(n).y + GD_rank(g)[ND_rank(n)].ht2);
     if (b.LL.x < b.UR.x && b.LL.y < b.UR.y)
        endp->boxes[endp->boxn++] = b;
 }
@@ -903,7 +899,7 @@ makeBottomFlatEnd (spline_info_t* sp, path* P, node_t* n, edge_t* e,
     else endpath(P, e, FLATEDGE, endp, FALSE);
     b.UR.y = endp->boxes[endp->boxn - 1].UR.y;
     b.LL.y = endp->boxes[endp->boxn - 1].LL.y;
-    b = makeregularend(b, BOTTOM, ND_coord_i(n).y - GD_rank(g)[ND_rank(n)].ht2);
+    b = makeregularend(b, BOTTOM, ND_coord(n).y - GD_rank(g)[ND_rank(n)].ht2);
     if (b.LL.x < b.UR.x && b.LL.y < b.UR.y)
        endp->boxes[endp->boxn++] = b;
 }
@@ -929,16 +925,13 @@ make_flat_labeled_edge(spline_info_t* sp, path* P, edge_t* e, int et)
 
     for (f = ED_to_virt(e); ED_to_virt(f); f = ED_to_virt(f));
     ln = f->tail;
-    P2PF(ND_coord_i(ln), ED_label(e)->pos);
+    ED_label(e)->pos = ND_coord(ln);
 
     if (et == ET_LINE) {
-       pointf np, startp, endp, lp;
-
-        P2PF(ND_coord_i(tn), np);
-       startp = add_pointfs(np, ED_tail_port(e).p);
+       pointf startp, endp, lp;
 
-        P2PF(ND_coord_i(hn), np);
-       endp = add_pointfs(np, ED_head_port(e).p);
+       startp = add_pointfs(ND_coord(tn), ED_tail_port(e).p);
+       endp = add_pointfs(ND_coord(hn), ED_head_port(e).p);
 
         lp = ED_label(e)->pos;
        lp.y -= (ED_label(e)->dimen.y)/2.0;
@@ -949,11 +942,11 @@ make_flat_labeled_edge(spline_info_t* sp, path* P, edge_t* e, int et)
        pn = 7;
     }
     else {
-       lb.LL.x = ND_coord_i(ln).x - ND_lw_i(ln);
-       lb.UR.x = ND_coord_i(ln).x + ND_rw_i(ln);
-       lb.UR.y = ND_coord_i(ln).y + ND_ht_i(ln)/2;
-       ydelta = ND_coord_i(ln).y - GD_rank(g)[ND_rank(tn)].ht1 -
-               ND_coord_i(tn).y + GD_rank(g)[ND_rank(tn)].ht2;
+       lb.LL.x = ND_coord(ln).x - ND_lw_i(ln);
+       lb.UR.x = ND_coord(ln).x + ND_rw_i(ln);
+       lb.UR.y = ND_coord(ln).y + ND_ht_i(ln)/2;
+       ydelta = ND_coord(ln).y - GD_rank(g)[ND_rank(tn)].ht1 -
+               ND_coord(tn).y + GD_rank(g)[ND_rank(tn)].ht2;
        ydelta /= 6.;
        lb.LL.y = lb.UR.y - MAX(5.,ydelta); 
 
@@ -1007,8 +1000,8 @@ make_flat_bottom_edges(spline_info_t* sp, path * P, edge_t ** edges, int
     r = ND_rank(tn);
     if (r < GD_maxrank(g)) {
        nextr = GD_rank(g) + (r+1);
-       vspace = ND_coord_i(tn).y - GD_rank(g)[r].pht1 -
-               (ND_coord_i(nextr->v[0]).y + nextr->pht2);
+       vspace = ND_coord(tn).y - GD_rank(g)[r].pht1 -
+               (ND_coord(nextr->v[0]).y + nextr->pht2);
     }
     else {
        vspace = GD_ranksep(g);
@@ -1113,7 +1106,7 @@ make_flat_edge(spline_info_t* sp, path * P, edge_t ** edges, int ind, int cnt, i
            prevr = GD_rank(g) + (r-2);
        else
            prevr = GD_rank(g) + (r-1);
-       vspace = ND_coord_i(prevr->v[0]).y - prevr->ht1 - ND_coord_i(tn).y - GD_rank(g)[r].ht2;
+       vspace = ND_coord(prevr->v[0]).y - prevr->ht1 - ND_coord(tn).y - GD_rank(g)[r].ht2;
     }
     else {
        vspace = GD_ranksep(g);
@@ -1196,7 +1189,7 @@ makeLineEdge(edge_t* fe, pointf* points, node_t** hp)
     node_t* hn;
     node_t* tn;
     edge_t* e = fe;
-    pointf np, startp, endp, lp;
+    pointf startp, endp, lp;
     pointf dimen;
     double width, height;
 
@@ -1209,17 +1202,13 @@ makeLineEdge(edge_t* fe, pointf* points, node_t** hp)
        return 0;
     if (fe->tail == e->tail) {
        *hp = hn;
-       P2PF(ND_coord_i(tn), np);
-       startp = add_pointfs(np, ED_tail_port(e).p);
-       P2PF(ND_coord_i(hn), np);
-       endp = add_pointfs(np, ED_head_port(e).p);
+       startp = add_pointfs(ND_coord(tn), ED_tail_port(e).p);
+       endp = add_pointfs(ND_coord(hn), ED_head_port(e).p);
     }
     else {
        *hp = tn; 
-       P2PF(ND_coord_i(hn), np);
-       startp = add_pointfs(np, ED_head_port(e).p);
-       P2PF(ND_coord_i(tn), np);
-       endp = add_pointfs(np, ED_tail_port(e).p);
+       startp = add_pointfs(ND_coord(hn), ED_head_port(e).p);
+       endp = add_pointfs(ND_coord(tn), ED_tail_port(e).p);
     }
 
     if (ED_label(e)) {
@@ -1320,7 +1309,7 @@ make_regular_edge(spline_info_t* sp, path * P, edge_t ** edges, int ind, int cnt
        b.UR.y = tend.boxes[tend.boxn - 1].UR.y;
        b.LL.y = tend.boxes[tend.boxn - 1].LL.y;
        b = makeregularend(b, BOTTOM,
-                  ND_coord_i(tn).y - GD_rank(tn->graph)[ND_rank(tn)].ht1);
+                  ND_coord(tn).y - GD_rank(tn->graph)[ND_rank(tn)].ht1);
        if (b.LL.x < b.UR.x && b.LL.y < b.UR.y)
            tend.boxes[tend.boxn++] = b;
        longedge = 0;
@@ -1345,7 +1334,7 @@ make_regular_edge(spline_info_t* sp, path * P, edge_t ** edges, int ind, int cnt
            hend.nb = maximal_bbox(sp, hn, e, ND_out(hn).list[0]);
            endpath(P, e, REGULAREDGE, &hend, spline_merge(e->head));
            b = makeregularend(hend.boxes[hend.boxn - 1], TOP,
-                      ND_coord_i(hn).y + GD_rank(hn->graph)[ND_rank(hn)].ht2);
+                      ND_coord(hn).y + GD_rank(hn->graph)[ND_rank(hn)].ht2);
            if (b.LL.x < b.UR.x && b.LL.y < b.UR.y)
                hend.boxes[hend.boxn++] = b;
            P->end.theta = M_PI / 2, P->end.constrained = TRUE;
@@ -1373,7 +1362,7 @@ make_regular_edge(spline_info_t* sp, path * P, edge_t ** edges, int ind, int cnt
            tend.nb = maximal_bbox(sp, tn, ND_in(tn).list[0], e);
            beginpath(P, e, REGULAREDGE, &tend, spline_merge(e->tail));
            b = makeregularend(tend.boxes[tend.boxn - 1], BOTTOM,
-                      ND_coord_i(tn).y - GD_rank(tn->graph)[ND_rank(tn)].ht1);
+                      ND_coord(tn).y - GD_rank(tn->graph)[ND_rank(tn)].ht1);
            if (b.LL.x < b.UR.x && b.LL.y < b.UR.y)
                tend.boxes[tend.boxn++] = b;
            P->start.theta = -M_PI / 2, P->start.constrained = TRUE;
@@ -1386,7 +1375,7 @@ make_regular_edge(spline_info_t* sp, path * P, edge_t ** edges, int ind, int cnt
        b.UR.y = hend.boxes[hend.boxn - 1].UR.y;
        b.LL.y = hend.boxes[hend.boxn - 1].LL.y;
        b = makeregularend(b, TOP,
-                  ND_coord_i(hn).y + GD_rank(hn->graph)[ND_rank(hn)].ht2);
+                  ND_coord(hn).y + GD_rank(hn->graph)[ND_rank(hn)].ht2);
        if (b.LL.x < b.UR.x && b.LL.y < b.UR.y)
            hend.boxes[hend.boxn++] = b;
        completeregularpath(P, segfirst, e, &tend, &hend, boxes, boxn,
@@ -1738,9 +1727,9 @@ static boxf rank_box(spline_info_t* sp, graph_t * g, int r)
        left1 = GD_rank(g)[r + 1].v[0];
        /* right1 = GD_rank(g)[r + 1].v[GD_rank(g)[r + 1].n - 1]; */
        b.LL.x = sp->LeftBound;
-       b.LL.y = ND_coord_i(left1).y + GD_rank(g)[r + 1].ht2;
+       b.LL.y = ND_coord(left1).y + GD_rank(g)[r + 1].ht2;
        b.UR.x = sp->RightBound;
-       b.UR.y = ND_coord_i(left0).y - GD_rank(g)[r].ht1;
+       b.UR.y = ND_coord(left0).y - GD_rank(g)[r].ht1;
        sp->Rank_box[r] = b;
     }
     return b;
@@ -1759,7 +1748,7 @@ static int straight_len(node_t * n)
            break;
        if ((ND_out(v).size != 1) || (ND_in(v).size != 1))
            break;
-       if (ND_coord_i(v).x != ND_coord_i(n).x)
+       if (ND_coord(v).x != ND_coord(n).x)
            break;
        cnt++;
     }
@@ -1775,7 +1764,7 @@ static edge_t *straight_path(edge_t * e, int cnt, pointf * plist, int *np)
        f = ND_out(f->head).list[0];
     plist[(*np)++] = plist[n - 1];
     plist[(*np)++] = plist[n - 1];
-    P2PF(ND_coord_i(f->tail), plist[(*np)]); /* will be overwritten by next spline */
+    plist[(*np)] = ND_coord(f->tail);  /* will be overwritten by next spline */
 
     return f;
 }
@@ -1789,11 +1778,11 @@ static void recover_slack(edge_t * e, path * p)
     for (vn = e->head;
         ND_node_type(vn) == VIRTUAL && !sinfo.splineMerge(vn);
         vn = ND_out(vn).list[0]->head) {
-       while ((b < p->nbox) && (p->boxes[b].LL.y > ND_coord_i(vn).y))
+       while ((b < p->nbox) && (p->boxes[b].LL.y > ND_coord(vn).y))
            b++;
        if (b >= p->nbox)
            break;
-       if (p->boxes[b].UR.y < ND_coord_i(vn).y)
+       if (p->boxes[b].UR.y < ND_coord(vn).y)
            continue;
        if (ND_label(vn))
            resize_vn(vn, p->boxes[b].LL.x, p->boxes[b].UR.x,
@@ -1809,7 +1798,7 @@ static void resize_vn(vn, lx, cx, rx)
 node_t *vn;
 int lx, cx, rx;
 {
-    ND_coord_i(vn).x = cx;
+    ND_coord(vn).x = cx;
     ND_lw_i(vn) = cx - lx, ND_rw_i(vn) = rx - cx;
 }
 
@@ -1858,75 +1847,12 @@ static edge_t *bot_bound(edge_t * e, int side)
     return ans;
 }
 
-#if 0
-/* not used */
-
-point closest(splines * spl, point p)
-{
-    int i, j, k, besti, bestj;
-    double bestdist2, d2, dlow2, dhigh2; /* squares of distance */
-    double low, high, t;
-    pointf c[4], pt2, pt;
-    point rv;
-    bezier bz;
-
-    besti = bestj = -1;
-    bestdist2 = 1e+38;
-    P2PF(p, pt);
-    for (i = 0; i < spl->size; i++) {
-       bz = spl->list[i];
-       for (j = 0; j < bz.size; j++) {
-           pointf b;
-
-           b.x = bz.list[j].x;
-           b.y = bz.list[j].y;
-           d2 = DIST2(b, pt);
-           if ((bestj == -1) || (d2 < bestdist2)) {
-               besti = i;
-               bestj = j;
-               bestdist2 = d2;
-           }
-       }
-    }
-
-    bz = spl->list[besti];
-    j = bestj / 3;
-    if (j >= spl->size)
-       j--;
-    for (k = 0; k < 4; k++) {
-       c[k].x = bz.list[j + k].x;
-       c[k].y = bz.list[j + k].y;
-    }
-    low = 0.0;
-    high = 1.0;
-    dlow2 = DIST2(c[0], pt);
-    dhigh2 = DIST2(c[3], pt);
-    do {
-       t = (low + high) / 2.0;
-       pt2 = Bezier(c, 3, t, NULL, NULL);
-       if (fabs(dlow2 - dhigh2) < 1.0)
-           break;
-       if (fabs(high - low) < .00001)
-           break;
-       if (dlow2 < dhigh2) {
-           high = t;
-           dhigh2 = DIST2(pt2, pt);
-       } else {
-           low = t;
-           dlow2 = DIST2(pt2, pt);
-       }
-    } while (1);
-    PF2P(pt2, rv);
-    return rv;
-}
-#endif
-
 /* common routines */
 
 static int cl_vninside(graph_t * cl, node_t * n)
 {
-    return (BETWEEN(GD_bb(cl).LL.x, (double)(ND_coord_i(n).x), GD_bb(cl).UR.x) &&
-           BETWEEN(GD_bb(cl).LL.y, (double)(ND_coord_i(n).y), GD_bb(cl).UR.y));
+    return (BETWEEN(GD_bb(cl).LL.x, (double)(ND_coord(n).x), GD_bb(cl).UR.x) &&
+           BETWEEN(GD_bb(cl).LL.y, (double)(ND_coord(n).y), GD_bb(cl).UR.y));
 }
 
 /* returns the cluster of (adj) that interferes with n,
@@ -1983,12 +1909,12 @@ static boxf maximal_bbox(spline_info_t* sp, node_t* vn, edge_t* ie, edge_t* oe)
     left_cl = right_cl = NULL;
 
     /* give this node all the available space up to its neighbors */
-    b = (double)(ND_coord_i(vn).x - ND_lw_i(vn) - FUDGE);
+    b = (double)(ND_coord(vn).x - ND_lw_i(vn) - FUDGE);
     if ((left = neighbor(vn, ie, oe, -1))) {
        if ((left_cl = cl_bound(vn, left)))
            nb = GD_bb(left_cl).UR.x + (double)(sp->Splinesep);
        else {
-           nb = (double)(ND_coord_i(left).x + ND_mval(left));
+           nb = (double)(ND_coord(left).x + ND_mval(left));
            if (ND_node_type(left) == NORMAL)
                nb += GD_nodesep(g) / 2.;
            else
@@ -2002,14 +1928,14 @@ static boxf maximal_bbox(spline_info_t* sp, node_t* vn, edge_t* ie, edge_t* oe)
 
     /* we have to leave room for our own label! */
     if ((ND_node_type(vn) == VIRTUAL) && (ND_label(vn)))
-       b = (double)(ND_coord_i(vn).x + 10);
+       b = (double)(ND_coord(vn).x + 10);
     else
-       b = (double)(ND_coord_i(vn).x + ND_rw_i(vn) + FUDGE);
+       b = (double)(ND_coord(vn).x + ND_rw_i(vn) + FUDGE);
     if ((right = neighbor(vn, ie, oe, 1))) {
        if ((right_cl = cl_bound(vn, right)))
            nb = GD_bb(right_cl).LL.x - (double)(sp->Splinesep);
        else {
-           nb = ND_coord_i(right).x - ND_lw_i(right);
+           nb = ND_coord(right).x - ND_lw_i(right);
            if (ND_node_type(right) == NORMAL)
                nb -= GD_nodesep(g) / 2.;
            else
@@ -2024,8 +1950,8 @@ static boxf maximal_bbox(spline_info_t* sp, node_t* vn, edge_t* ie, edge_t* oe)
     if ((ND_node_type(vn) == VIRTUAL) && (ND_label(vn)))
        rv.UR.x -= ND_rw_i(vn);
 
-    rv.LL.y = ND_coord_i(vn).y - GD_rank(g)[ND_rank(vn)].ht1;
-    rv.UR.y = ND_coord_i(vn).y + GD_rank(g)[ND_rank(vn)].ht2;
+    rv.LL.y = ND_coord(vn).y - GD_rank(g)[ND_rank(vn)].ht1;
+    rv.UR.y = ND_coord(vn).y + GD_rank(g)[ND_rank(vn)].ht2;
     return rv;
 }
 
index 494d4ca1c07b729c3285b9b761ab76a84840aa9a..aeb9395ee211d15b1edd9efb10963e87560698f2 100644 (file)
@@ -152,10 +152,10 @@ flat_node(edge_t * e)
     place = flat_limits(g, e);
     /* grab ypos = LL.y of label box before make_vn_slot() */
     if ((n = GD_rank(g)[r - 1].v[0]))
-       ypos = ND_coord_i(n).y - GD_rank(g)[r - 1].ht1;
+       ypos = ND_coord(n).y - GD_rank(g)[r - 1].ht1;
     else {
        n = GD_rank(g)[r].v[0];
-       ypos = ND_coord_i(n).y + GD_rank(g)[r].ht2 + GD_ranksep(g);
+       ypos = ND_coord(n).y + GD_rank(g)[r].ht2 + GD_ranksep(g);
     }
     vn = make_vn_slot(g, r - 1, place);
     dimen = ED_label(e)->dimen;
@@ -168,7 +168,7 @@ flat_node(edge_t * e)
     h2 = ND_ht_i(vn) / 2;
     ND_lw_i(vn) = ND_rw_i(vn) = dimen.x / 2;
     ND_label(vn) = ED_label(e);
-    ND_coord_i(vn).y = ypos + h2;
+    ND_coord(vn).y = ypos + h2;
     ve = virtual_edge(vn, e->tail, e); /* was NULL? */
     ED_tail_port(ve).p.x = -ND_lw_i(vn);
     ED_head_port(ve).p.x = ND_rw_i(e->tail);
index 56bdf8122f26ca24dba917952fe0a97fa219ead0..4e6a370d0f749bd276d9336fa23900a9692622d2 100644 (file)
@@ -16,7 +16,7 @@
 
 
 /*
- * position(g): set ND_coord_i(n) (x and y) for all nodes n of g, using GD_rank(g).
+ * position(g): set ND_coord(n) (x and y) for all nodes n of g, using GD_rank(g).
  * (the graph may be modified by merging certain edges with a common endpoint.)
  * the coordinates are computed by constructing and ranking an auxiliary graph.
  * then leaf nodes are inserted in the fast graph.  cluster boundary nodes are
@@ -574,7 +574,7 @@ set_xcoords(graph_t * g)
     for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
        for (j = 0; j < rank[i].n; j++) {
            v = rank[i].v[j];
-           ND_coord_i(v).x = ND_rank(v);
+           ND_coord(v).x = ND_rank(v);
            ND_rank(v) = i;
        }
     }
@@ -711,8 +711,7 @@ static void adjustRanks(graph_t * g, int equal)
        lht = MAX(GD_border(g)[LEFT_IX].y, GD_border(g)[RIGHT_IX].y);
        maxr = GD_maxrank(g);
        minr = GD_minrank(g);
-       rht =
-           ND_coord_i(rank[minr].v[0]).y - ND_coord_i(rank[maxr].v[0]).y;
+       rht = ND_coord(rank[minr].v[0]).y - ND_coord(rank[maxr].v[0]).y;
        delta = lht - (rht + ht1 + ht2);
        if (delta > 0) {
            if (equal)
@@ -857,7 +856,7 @@ static void set_ycoords(graph_t * g)
 
     /* copy ycoord assignment from leftmost nodes to others */
     for (n = GD_nlist(g); n; n = ND_next(n))
-       ND_coord_i(n).y = rank[ND_rank(n)].v[0]->u.coord.y;
+       ND_coord(n).y = rank[ND_rank(n)].v[0]->u.coord.y;
 }
 
 /* dot_compute_bb:
@@ -886,7 +885,7 @@ static void dot_compute_bb(graph_t * g, graph_t * root)
            for (c = 1; (ND_node_type(v) != NORMAL) && c < rnkn; c++)
                v = GD_rank(g)[r].v[c];
            if (ND_node_type(v) == NORMAL) {
-               x = (double)(ND_coord_i(v).x - ND_lw_i(v));
+               x = ND_coord(v).x - ND_lw_i(v);
                LL.x = MIN(LL.x, x);
            }
            else continue;
@@ -894,7 +893,7 @@ static void dot_compute_bb(graph_t * g, graph_t * root)
            v = GD_rank(g)[r].v[rnkn - 1];
            for (c = rnkn-2; ND_node_type(v) != NORMAL; c--)
                v = GD_rank(g)[r].v[c];
-           x = (double)(ND_coord_i(v).x + ND_rw_i(v));
+           x = ND_coord(v).x + ND_rw_i(v);
            UR.x = MAX(UR.x, x);
        }
        offset = CL_OFFSET;
@@ -1014,8 +1013,8 @@ static void set_aspect(graph_t * g)
                yf = t;
            }
            for (n = GD_nlist(g); n; n = ND_next(n)) {
-               ND_coord_i(n).x = ND_coord_i(n).x * xf;
-               ND_coord_i(n).y = ND_coord_i(n).y * yf;
+               ND_coord(n).x = ROUND(ND_coord(n).x * xf);
+               ND_coord(n).y = ROUND(ND_coord(n).y * yf);
            }
            scale_bb(g, g, xf, yf);
        }
@@ -1025,10 +1024,9 @@ static void set_aspect(graph_t * g)
 static point resize_leaf(node_t * leaf, point lbound)
 {
     dot_nodesize(leaf, GD_flip(leaf->graph));
-    ND_coord_i(leaf).y = lbound.y;
-    ND_coord_i(leaf).x = lbound.x + ND_lw_i(leaf);
-    lbound.x =
-       lbound.x + ND_lw_i(leaf) + ND_rw_i(leaf) + GD_nodesep(leaf->graph);
+    ND_coord(leaf).y = lbound.y;
+    ND_coord(leaf).x = lbound.x + ND_lw_i(leaf);
+    lbound.x = lbound.x + ND_lw_i(leaf) + ND_rw_i(leaf) + GD_nodesep(leaf->graph);
     return lbound;
 }
 
@@ -1083,8 +1081,8 @@ static void do_leaves(graph_t * g, node_t * leader)
 
     if (ND_UF_size(leader) <= 1)
        return;
-    lbound.x = ND_coord_i(leader).x - ND_lw_i(leader);
-    lbound.y = ND_coord_i(leader).y;
+    lbound.x = ND_coord(leader).x - ND_lw_i(leader);
+    lbound.y = ND_coord(leader).y;
     lbound = resize_leaf(leader, lbound);
     if (ND_out(leader).size > 0) {     /* in-edge leaves */
        n = ND_out(leader).list[0]->head;
index aca7cc057a47ef3d110f853032747abace9d047e..c2a827175193fcbb0c95d285b8d988171ec021e0 100644 (file)
@@ -125,8 +125,8 @@ static void sameport(node_t * u, elist * l, double arr_len)
            v = e->tail;
        else
            v = e->head;
-       x1 = ND_coord_i(v).x - ND_coord_i(u).x;
-       y1 = ND_coord_i(v).y - ND_coord_i(u).y;
+       x1 = ND_coord(v).x - ND_coord(u).x;
+       y1 = ND_coord(v).y - ND_coord(u).y;
        r = hypot(x1, y1);
        x += x1 / r;
        y += y1 / r;
@@ -136,11 +136,11 @@ static void sameport(node_t * u, elist * l, double arr_len)
     y /= r;
 
     /* (x1,y1),(x2,y2) is a segment that must cross the node boundary */
-    x1 = ND_coord_i(u).x;
-    y1 = ND_coord_i(u).y;      /* center of node */
+    x1 = ND_coord(u).x;
+    y1 = ND_coord(u).y;        /* center of node */
     r = MAX(ND_lw_i(u) + ND_rw_i(u), ND_ht_i(u) + GD_ranksep(u->graph));       /* far away */
-    x2 = x * r + ND_coord_i(u).x;
-    y2 = y * r + ND_coord_i(u).y;
+    x2 = x * r + ND_coord(u).x;
+    y2 = y * r + ND_coord(u).y;
     {                          /* now move (x1,y1) to the node boundary */
        pointf curve[4];                /* bezier control points for a straight line */
        curve[0].x = x1;
@@ -153,8 +153,8 @@ static void sameport(node_t * u, elist * l, double arr_len)
        curve[3].y = y2;
 
        shape_clip(u, curve);
-       x1 = curve[0].x - ND_coord_i(u).x;
-       y1 = curve[0].y - ND_coord_i(u).y;
+       x1 = curve[0].x - ND_coord(u).x;
+       y1 = curve[0].y - ND_coord(u).y;
     }
 
     /* compute PORT on the boundary */
index 21ad4cecd0cfc46c28e05016e428dc9a98e99174..814715670c993403d724ad35cf048a83c7c1ccb4 100644 (file)
@@ -628,8 +628,8 @@ int init_nop(Agraph_t * g, int adjust)
        node_t *n;
        State = GVSPLINES;
        for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-           ND_coord_i(n).x = POINTS(ND_pos(n)[0]);
-           ND_coord_i(n).y = POINTS(ND_pos(n)[1]);
+           ND_coord(n).x = POINTS(ND_pos(n)[0]);
+           ND_coord(n).y = POINTS(ND_pos(n)[1]);
        }
     }
     else if (posEdges != AllEdges)
index bf5828525d298ee1ed47aa0a2e00efed11217066..a6f2264833c4e583b41ee32fad774002337a8bf8 100644 (file)
@@ -88,7 +88,7 @@ make_barriers(Ppoly_t ** poly, int npoly, int pp, int qp,
 
 /* genPt:
  */
-static Ppoint_t genPt(double x, double y, point c)
+static Ppoint_t genPt(double x, double y, pointf c)
 {
     Ppoint_t p;
 
@@ -100,7 +100,7 @@ static Ppoint_t genPt(double x, double y, point c)
 
 /* recPt:
  */
-static Ppoint_t recPt(double x, double y, point c, expand_t* m)
+static Ppoint_t recPt(double x, double y, pointf c, expand_t* m)
 {
     Ppoint_t p;
 
@@ -428,14 +428,10 @@ makeStraightEdge(graph_t * g, edge_t * e, int doPolyline)
     int i, j, xstep, dx;
     double l_perp;
     pointf dumber[4];
-    pointf p, q, np;
-
-    P2PF(ND_coord_i(n), np);
-    p = dumb[1] = dumb[0] = add_pointfs(np, ED_tail_port(e).p);
-
-    P2PF(ND_coord_i(head), np);
-    q = dumb[2] = dumb[3] = add_pointfs(np, ED_head_port(e).p);
+    pointf p, q;
 
+    p = dumb[1] = dumb[0] = add_pointfs(ND_coord(n), ED_tail_port(e).p);
+    q = dumb[2] = dumb[3] = add_pointfs(ND_coord(head), ED_head_port(e).p);
     if (e_cnt == 1) {
        clip_and_install(e, e->head, dumb, 4, &sinfo);
        addEdgeLabels(e, p, q);
@@ -523,7 +519,7 @@ Ppoly_t *makeObstacle(node_t * n, expand_t* pmargin)
     int j, sides;
     pointf polyp;
     boxf b;
-    point pt;
+    pointf pt;
     field_t *fld;
     epsf_t *desc;
 
@@ -590,8 +586,8 @@ Ppoly_t *makeObstacle(node_t * n, expand_t* pmargin)
                    polyp.y = pmargin->y * s * ND_ht_i(n) / 2.0;
                }
            }
-           obs->ps[sides - j - 1].x = polyp.x + ND_coord_i(n).x;
-           obs->ps[sides - j - 1].y = polyp.y + ND_coord_i(n).y;
+           obs->ps[sides - j - 1].x = polyp.x + ND_coord(n).x;
+           obs->ps[sides - j - 1].y = polyp.y + ND_coord(n).y;
        }
        break;
     case SH_RECORD:
@@ -601,7 +597,7 @@ Ppoly_t *makeObstacle(node_t * n, expand_t* pmargin)
        obs->pn = 4;
        obs->ps = N_NEW(4, Ppoint_t);
        /* CW order */
-       pt = ND_coord_i(n);
+       pt = ND_coord(n);
        if (pmargin->doAdd) {
            obs->ps[0] = genPt(b.LL.x-pmargin->x, b.LL.y-pmargin->y, pt);
            obs->ps[1] = genPt(b.LL.x-pmargin->x, b.UR.y+pmargin->y, pt);
@@ -621,7 +617,7 @@ Ppoly_t *makeObstacle(node_t * n, expand_t* pmargin)
        obs->pn = 4;
        obs->ps = N_NEW(4, Ppoint_t);
        /* CW order */
-       pt = ND_coord_i(n);
+       pt = ND_coord(n);
        if (pmargin->doAdd) {
            obs->ps[0] = genPt(-ND_lw_i(n)-pmargin->x, -ND_ht_i(n)-pmargin->y,pt);
            obs->ps[1] = genPt(-ND_lw_i(n)-pmargin->x, ND_ht_i(n)+pmargin->y,pt);
@@ -658,12 +654,9 @@ getPath(edge_t * e, vconfig_t * vconfig, int chkPts, Ppoly_t ** obs,
     Ppolyline_t line;
     int pp, qp;
     Ppoint_t p, q;
-    pointf tp, hp;
 
-    P2PF(ND_coord_i(e->tail), tp);
-    p = add_pointfs(tp, ED_tail_port(e).p);
-    P2PF(ND_coord_i(e->head), hp);
-    q = add_pointfs(hp, ED_head_port(e).p);
+    p = add_pointfs(ND_coord(e->tail), ED_tail_port(e).p);
+    q = add_pointfs(ND_coord(e->head), ED_head_port(e).p);
 
     /* determine the polygons (if any) that contain the endpoints */
     pp = qp = POLYID_NONE;
@@ -822,12 +815,9 @@ static int _spline_edges(graph_t * g, expand_t* pmargin, int edgetype)
 /* fprintf (stderr, "%s -- %s %d\n", e->tail->name, e->head->name, ED_count(e)); */
            node_t *head = e->head;
            if (useEdges && ED_spl(e)) {
-               pointf np, hp;
-               P2PF(ND_coord_i(n), np);
-               P2PF(ND_coord_i(head), hp);
                addEdgeLabels(e,
-                             add_pointfs(np, ED_tail_port(e).p),
-                             add_pointfs(hp, ED_head_port(e).p));
+                             add_pointfs(ND_coord(n), ED_tail_port(e).p),
+                             add_pointfs(ND_coord(head), ED_head_port(e).p));
            } 
            else if (ED_count(e) == 0) continue;  /* only do representative */
            else if (n == head) {    /* self arc */
@@ -1169,7 +1159,7 @@ static void _neato_set_aspect(graph_t * g)
 /* neato_set_aspect:
  * Sets aspect ratio if necessary; real work done in _neato_set_aspect;
  * This also copies the internal layout coordinates (ND_pos) to the 
- * external ones (ND_coord_i).
+ * external ones (ND_coord).
  */
 void neato_set_aspect(graph_t * g)
 {
@@ -1177,8 +1167,8 @@ void neato_set_aspect(graph_t * g)
 
     _neato_set_aspect(g);
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
-       ND_coord_i(n).x = POINTS(ND_pos(n)[0]);
-       ND_coord_i(n).y = POINTS(ND_pos(n)[1]);
+       ND_coord(n).x = POINTS(ND_pos(n)[0]);
+       ND_coord(n).y = POINTS(ND_pos(n)[1]);
     }
 }
 
index 2a5f861f310c5c6047eaef989ee9fef0da4ca6d6..0a9e4b626bc6ea767ea2ec8c7349b180e831e464 100644 (file)
@@ -781,7 +781,7 @@ shiftGraphs(int ng, Agraph_t ** gs, point * pp, Agraph_t * root,
        for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
            ND_pos(n)[0] += fx;
            ND_pos(n)[1] += fy;
-           MOVEPT(ND_coord_i(n));
+           MOVEPT(ND_coord(n));
            if (doSplines) {
                for (e = agfstout(eg, n); e; e = agnxtout(eg, e))
                    shiftEdge(e, dx, dy);
index 118c0521d88993cac05082335fe54bed102fad01..56c40312563f392498e65b148c07c67625818406 100644 (file)
@@ -163,7 +163,7 @@ static rect_t walker(treenode_t *tree)
 {
        treenode_t      *p;
        Agnode_t        *n;
-       point           center;
+       pointf          center;
     rect_t      r, rr;
 
        switch(tree->kind) {
@@ -176,13 +176,13 @@ static rect_t walker(treenode_t *tree)
                        center.y = (tree->r.UR.y + tree->r.LL.y) / 2.0;
 
                        n = tree->u.n;
-                       ND_coord_i(n) = center;
+                       ND_coord(n) = center;
                        ND_height(n) = PS2INCH(tree->r.UR.y - tree->r.LL.y);
                        ND_width(n) = PS2INCH(tree->r.UR.x - tree->r.LL.x);
                        gv_nodesize(n,GD_flip(n->graph));
                        finishNode (n);
-                       /*fprintf(stderr,"%s coord %d %d ht %d width %d\n",
-                               n->name, ND_coord_i(n).x, ND_coord_i(n).y, ND_ht_i(n),
+                       /*fprintf(stderr,"%s coord %.3g %.3g ht %d width %d\n",
+                               n->name, ND_coord(n).x, ND_coord(n).y, ND_ht_i(n),
                                ND_rw_i(n)+ND_lw_i(n));*/
                        break;
                default: abort();
index 360d0f76b6a3f080b4e22d6acd7ff62ee0b2fecb..67a1bc51239b327d86db03c3220d28a4d510ce38 100644 (file)
@@ -136,11 +136,11 @@ static pointf vrml_node_point(GVJ_t *job, node_t *n, pointf p)
 
     /* make rv relative to PNG canvas */
     if (job->rotation) {
-       rv.x = ( (p.y - job->pad.y) - ND_coord_i(n).y + ND_lw_i(n)     ) * Scale + NODE_PAD;
-       rv.y = (-(p.x - job->pad.x) + ND_coord_i(n).x + ND_ht_i(n) / 2.) * Scale + NODE_PAD;
+       rv.x = ( (p.y - job->pad.y) - ND_coord(n).y + ND_lw_i(n)     ) * Scale + NODE_PAD;
+       rv.y = (-(p.x - job->pad.x) + ND_coord(n).x + ND_ht_i(n) / 2.) * Scale + NODE_PAD;
     } else {
-       rv.x = ( (p.x - job->pad.x) - ND_coord_i(n).x + ND_lw_i(n)     ) * Scale + NODE_PAD;
-       rv.y = (-(p.y - job->pad.y) + ND_coord_i(n).y + ND_ht_i(n) / 2.) * Scale + NODE_PAD;
+       rv.x = ( (p.x - job->pad.x) - ND_coord(n).x + ND_lw_i(n)     ) * Scale + NODE_PAD;
+       rv.y = (-(p.y - job->pad.y) + ND_coord(n).y + ND_ht_i(n) / 2.) * Scale + NODE_PAD;
     }
     return rv;
 }
@@ -292,8 +292,8 @@ static void vrml_begin_edge(GVJ_t *job)
 static void
 finishSegment (FILE *out, edge_t *e)
 {
-    point p0 = ND_coord_i(e->tail);
-    point p1 = ND_coord_i(e->head);
+    pointf p0 = ND_coord(e->tail);
+    pointf p1 = ND_coord(e->head);
     double o_x, o_y, o_z;
     double x, y, y0, z, theta;
 
@@ -429,7 +429,7 @@ straight (pointf * A, int n)
 }
 
 static void
-doSegment (GVJ_t *job, pointf* A, point p0, double z0, point p1, double z1)
+doSegment (GVJ_t *job, pointf* A, pointf p0, double z0, pointf p1, double z1)
 {
     FILE *out = job->output_file;
     obj_state_t *obj = job->obj;
@@ -477,7 +477,7 @@ vrml_bezier(GVJ_t *job, pointf * A, int n, int arrow_at_start, int arrow_at_end,
     assert(e);
 
     if (straight(A,n)) {
-       doSegment (job, A, ND_coord_i(e->tail),Fstz,ND_coord_i(e->head),Sndz);
+       doSegment (job, A, ND_coord(e->tail),Fstz,ND_coord(e->head),Sndz);
        return;
     }
 
@@ -522,7 +522,6 @@ static void doArrowhead (GVJ_t *job, pointf * A)
     edge_t *e = obj->u.e;
     double rad, ht, y;
     pointf p0;      /* center of triangle base */
-    point  tp,hp;
 
     p0.x = (A[0].x + A[2].x)/2.0;
     p0.y = (A[0].y + A[2].y)/2.0;
@@ -531,10 +530,8 @@ static void doArrowhead (GVJ_t *job, pointf * A)
 
     y = (CylHt + ht)/2.0;
 
-    tp = ND_coord_i(e->tail);
-    hp = ND_coord_i(e->head);
     fprintf(out, "Transform {\n");
-    if (DIST2(A[1], tp) < DIST2(A[1], hp)) {
+    if (DIST2(A[1], ND_coord(e->tail)) < DIST2(A[1], ND_coord(e->head))) {
        TailHt = ht;
        fprintf(out, "  translation 0 %.3f 0\n", -y);
        fprintf(out, "  rotation 0 0 1 %.3f\n", M_PI);
@@ -611,16 +608,16 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
        fprintf(out, "  geometry Extrusion {\n");
        fprintf(out, "    crossSection [");
        for (i = 0; i < np; i++) {
-           p.x = A[i].x - ND_coord_i(n).x;
-           p.y = A[i].y - ND_coord_i(n).y;
+           p.x = A[i].x - ND_coord(n).x;
+           p.y = A[i].y - ND_coord(n).y;
            fprintf(out, " %.3f %.3f,", p.x, p.y);
        }
-       p.x = A[0].x - ND_coord_i(n).x;
-       p.y = A[0].y - ND_coord_i(n).y;
+       p.x = A[0].x - ND_coord(n).x;
+       p.y = A[0].y - ND_coord(n).y;
        fprintf(out, " %.3f %.3f ]\n", p.x, p.y);
-       fprintf(out, "    spine [ %d %d %.3f, %d %d %.3f ]\n",
-               ND_coord_i(n).x, ND_coord_i(n).y, z - .01,
-               ND_coord_i(n).x, ND_coord_i(n).y, z + .01);
+       fprintf(out, "    spine [ %.3g %.3g %.3g, %.3g %.3g %.3g ]\n",
+               ND_coord(n).x, ND_coord(n).y, z - .01,
+               ND_coord(n).x, ND_coord(n).y, z + .01);
        fprintf(out, "  }\n");
        fprintf(out, "}\n");
        break;
@@ -652,7 +649,7 @@ static void vrml_polygon(GVJ_t *job, pointf * A, int np, int filled)
                  (A[0].x + A[2].x) / 2.0 - A[1].x) + M_PI / 2.0;
 
        /* this is gruesome, but how else can we get z coord */
-       if (DIST2(p, ND_coord_i(e->tail)) < DIST2(p, ND_coord_i(e->head)))
+       if (DIST2(p, ND_coord(e->tail)) < DIST2(p, ND_coord(e->head)))
            z = obj->tail_z;
        else
            z = obj->head_z;
@@ -783,7 +780,7 @@ static void vrml_ellipse(GVJ_t * job, pointf * A, int filled)
     case EDGE_OBJTYPE:
        e = obj->u.e;
        /* this is gruesome, but how else can we get z coord */
-       if (DIST2(A[0], ND_coord_i(e->tail)) < DIST2(A[0], ND_coord_i(e->head)))
+       if (DIST2(A[0], ND_coord(e->tail)) < DIST2(A[0], ND_coord(e->head)))
            z = obj->tail_z;
        else
            z = obj->head_z;