]> granicus.if.org Git - graphviz/commitdiff
Fix a couple of typos and add end point fudge factors to the path to
authorEmden Gansner <erg@research.att.com>
Thu, 1 Mar 2012 18:34:29 +0000 (13:34 -0500)
committerEmden Gansner <erg@research.att.com>
Thu, 1 Mar 2012 18:34:29 +0000 (13:34 -0500)
guarantee the start and end points from ports will be interior to the
bounding boxes. This helps to avoid the possibility that the path planner
may create a degenerate spline running along box edges. Fixes bug 2205.

lib/common/splines.c

index ce8d78128f9c65abbee3dc1031031e197f458a0b..3c6514ec95389483d3e6dab461b3e714b660f821 100644 (file)
@@ -356,8 +356,8 @@ void add_box(path * P, boxf b)
 
 /* beginpath:
  * Set up boxes near the tail node.
- * For regular nodes, the result should be a list of continguous rectangles 
- * such that the last one ends has the smallest LL.y and its LL.y is above
+ * For regular nodes, the result should be a list of contiguous rectangles 
+ * such that the last one has the smallest LL.y and its LL.y is above
  * the bottom of the rank (rank.ht1).
  * 
  * For flat edges, we assume endp->sidemask has been set. For regular
@@ -493,6 +493,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            b.LL.y = MIN(b.LL.y,P->start.p.y);
            endp->boxes[0] = b;
            endp->boxn = 1;
+           P->start.p.y += 1;
        }
        else if (side & BOTTOM) {
            if (endp->sidemask == TOP) {
@@ -513,6 +514,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                endp->boxes[0] = b;
                endp->boxn = 1;
            }
+           P->start.p.y -= 1;
        }
        else if (side & LEFT) {
            b.UR.x = P->start.p.x+1;
@@ -526,6 +528,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            }
            endp->boxes[0] = b;
            endp->boxn = 1;
+           P->start.p.x -= 1;
        }
        else {
            b.LL.x = P->start.p.x;
@@ -539,6 +542,7 @@ beginpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            }
            endp->boxes[0] = b;
            endp->boxn = 1;
+           P->start.p.x += 1;
        }
        for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
        if (n == agtail(orig))
@@ -685,6 +689,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            b.LL.y = MIN(b.LL.y,P->end.p.y);
            endp->boxes[0] = b;
            endp->boxn = 1;
+           P->end.p.y += 1;
        }
        else if (side & BOTTOM) {
            if (endp->sidemask == TOP) {
@@ -705,6 +710,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
                endp->boxes[0] = b;
                endp->boxn = 1;
            }
+           P->end.p.y -= 1;
        }
        else if (side & LEFT) {
            b.UR.x = P->end.p.x+1;
@@ -718,6 +724,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            }
            endp->boxes[0] = b;
            endp->boxn = 1;
+           P->end.p.x -= 1;
        }
        else {
            b.LL.x = P->end.p.x-1;
@@ -731,6 +738,7 @@ void endpath(path * P, edge_t * e, int et, pathend_t * endp, boolean merge)
            }
            endp->boxes[0] = b;
            endp->boxn = 1;
+           P->end.p.x += 1;
        }
        for (orig = e; ED_edge_type(orig) != NORMAL; orig = ED_to_orig(orig));
        if (n == aghead(orig))