]> granicus.if.org Git - graphviz/commitdiff
make ellipses a little wider when sizing around a rectangular label or image
authorellson <devnull@localhost>
Mon, 3 Mar 2008 23:27:52 +0000 (23:27 +0000)
committerellson <devnull@localhost>
Mon, 3 Mar 2008 23:27:52 +0000 (23:27 +0000)
lib/common/shapes.c

index 23a302a4c4aa3ce8602e64a767954e9e30b6dd68..1e8e34e89113d2e4ac2a2341bfa9cdddbb899944 100644 (file)
@@ -823,33 +823,19 @@ static void poly_init(node_t * n)
        sides = 120;
     }
 
-#define SQRT2MINUS1 0.41421356237
-
     /* add extra padding to allow for the shape */
     if (sides <= 2) {
-       /* for ellipses, add padding based on the smaller radii */
-       if (dimen.y > dimen.x)
-           temp = dimen.x * SQRT2MINUS1;
-       else
-           temp = dimen.y * SQRT2MINUS1;
-       dimen.x += temp;
-       dimen.y += temp;
+       dimen.x *= SQRT2;
+       dimen.y *= SQRT2;
     } else if (sides == 4 && (ROUND(orientation) % 90) == 0
               && distortion == 0. && skew == 0.) {
        /* for regular boxes the fit should be exact */
     } else {
        /* for all other polygon shapes, compute the inner ellipse
           and then pad for that  */
-       temp = cos(M_PI / sides);
-       dimen.x /= temp;
-       dimen.y /= temp;
-       /* add padding based on the smaller radii */
-       if (dimen.y > dimen.x)
-           temp = dimen.x * SQRT2MINUS1;
-       else
-           temp = dimen.y * SQRT2MINUS1;
-       dimen.x += temp;
-       dimen.y += temp;
+       temp = SQRT2 / cos(M_PI / sides);
+       dimen.x *= temp;
+       dimen.y *= temp;
     }
 
     /* adjust text justification */