From: Emden R. Gansner Date: Wed, 28 May 2014 20:14:20 +0000 (-0400) Subject: Fix bug 2460 X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~205 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce55b22ff6be6aad9a748ff363470485a5d0adbb;p=graphviz Fix bug 2460 --- diff --git a/lib/dotgen/compound.c b/lib/dotgen/compound.c index 7156103af..dbbc27526 100644 --- a/lib/dotgen/compound.c +++ b/lib/dotgen/compound.c @@ -174,16 +174,17 @@ findVertical(pointf * pts, double tmin, double tmax, pointf Left[4]; pointf Right[4]; double t; - int no_cross = countVertCross(pts, xcoord); + int no_cross; - if (tmin >= tmax) - return -1.0; + if (tmin == tmax) + return tmin; + no_cross = countVertCross(pts, xcoord); if (no_cross == 0) return -1.0; - /* if 1 crossing and on the line x == xcoord (within 1 point) */ - if ((no_cross == 1) && (ROUND(pts[3].x) == ROUND(xcoord))) { + /* if 1 crossing and on the line x == xcoord (within 0.005 point) */ + if ((no_cross == 1) && (abs(pts[3].x - xcoord) <= 0.005)) { if ((ymin <= pts[3].y) && (pts[3].y <= ymax)) { return tmax; } else @@ -215,16 +216,17 @@ findHorizontal(pointf * pts, double tmin, double tmax, pointf Left[4]; pointf Right[4]; double t; - int no_cross = countHorzCross(pts, ycoord); + int no_cross; - if (tmin >= tmax) - return -1.0; + if (tmin == tmax) + return tmin; + no_cross = countHorzCross(pts, ycoord); if (no_cross == 0) return -1.0; - /* if 1 crossing and on the line y == ycoord (within 1 point) */ - if ((no_cross == 1) && (ROUND(pts[3].y) == ROUND(ycoord))) { + /* if 1 crossing and on the line y == ycoord (within 0.005 point) */ + if ((no_cross == 1) && (abs(pts[3].y - ycoord) <= 0.005)) { if ((xmin <= pts[3].x) && (pts[3].x <= xmax)) { return tmax; } else