]> granicus.if.org Git - graphviz/commitdiff
a fix for the extra space problem from bezier control points in bb
authorellson <devnull@localhost>
Tue, 8 Apr 2008 18:58:13 +0000 (18:58 +0000)
committerellson <devnull@localhost>
Tue, 8 Apr 2008 18:58:13 +0000 (18:58 +0000)
code needs refactoring.  same code is used in three places.

lib/common/splines.c
lib/dotgen/dotsplines.c

index 4703e0a19940d27cf93114ee3655017a619809f5..fe3491f68334fa24fd25c1f88570cff11f203abd 100644 (file)
@@ -319,9 +319,20 @@ clip_and_install(edge_t * fe, node_t * hn, point * ps, int pn,
        if (ps[end].x != ps[end + 3].x || ps[end].y != ps[end + 3].y)
            break;
     arrow_clip(fe, hn, ps, &start, &end, newspl, info);
-    for (i = start; i < end + 4; i++) {
-       point pt;
+    for (i = start; i < end + 4; ) {
+       point pt, pt1, pt2;
        pt = newspl->list[i - start] = ps[i];
+       i++;
+       update_bb(g, pt);
+       if ( i >= end + 4) 
+           break;
+       /* take the mid-point between the two control points in bb calculation */
+       pt1 = newspl->list[i - start] = ps[i];
+       i++;
+       pt2 = newspl->list[i - start] = ps[i];
+       i++;
+       pt.x = ( pt1.x + pt2.x ) / 2;
+       pt.y = ( pt1.y + pt2.y ) / 2;
        update_bb(g, pt);
     }
     newspl->size = end - start + 4;
index 1385c22ceed6231a9f5ccb65a7d6d46288e657b4..4c857b5585ee92a1bcb5411853a41fb04f63b204 100644 (file)
@@ -936,9 +936,20 @@ make_flat_adj_edges(path* P, edge_t** edges, int ind, int cnt, edge_t* e0,
            bz->eflag = auxbz->eflag;
            bz->ep = transform(auxbz->ep, del, 0);
        }
-       for (j = 0; j <  auxbz->size; j++) {
-           point pt;
+       for (j = 0; j <  auxbz->size; ) {
+           point pt, pt1, pt2;
            pt = bz->list[j] = transform(auxbz->list[j], del, GD_flip(g));
+           j++;
+           update_bb(g, pt);
+           if ( j >= auxbz->size ) 
+               break;
+           /* take the mid-point between the two control points in bb calculation */
+           pt1 = bz->list[j] = transform(auxbz->list[j], del, GD_flip(g));
+           j++;
+           pt2 = bz->list[j] = transform(auxbz->list[j], del, GD_flip(g));
+           j++;
+           pt.x = ( pt1.x + pt2.x ) / 2;
+           pt.y = ( pt1.y + pt2.y ) / 2;
            update_bb(g, pt);
         }
        if (ED_label(e)) {