]> granicus.if.org Git - graphviz/commitdiff
partial fix for NAN in node bb caculation, and removal of duplicated code.
authorellson <devnull@localhost>
Mon, 18 Aug 2008 16:42:12 +0000 (16:42 +0000)
committerellson <devnull@localhost>
Mon, 18 Aug 2008 16:42:12 +0000 (16:42 +0000)
lib/neatogen/poly.c

index 5d83c81445f3c00e233cdd105e9c728303813719..37da50e69c31d016cf741a057065dbfad871429c 100644 (file)
@@ -208,6 +208,7 @@ void makeAddPoly(Poly * pp, Agnode_t * n, float xmargin, float ymargin)
        case SH_POLY:
            poly = (polygon_t *) ND_shape_info(n);
            sides = poly->sides;
+#if 0
            if (sides >= 3) {   /* real polygon */
                verts = N_GNEW(sides, Point);
                for (i = 0; i < sides; i++) {
@@ -216,6 +217,7 @@ void makeAddPoly(Poly * pp, Agnode_t * n, float xmargin, float ymargin)
                }
            } else
                verts = genRound(n, &sides, 0, 0);
+#endif
 
            if (streq(ND_shape(n)->name, "box"))
                pp->kind = BOX;
@@ -242,12 +244,21 @@ void makeAddPoly(Poly * pp, Agnode_t * n, float xmargin, float ymargin)
                    verts[3].x = PS2INCH(poly->vertices[3].x) + xmargin;
                    verts[3].y = PS2INCH(poly->vertices[3].y) - ymargin;
                }
-               else for (i = 0; i < sides; i++) {
-                    double h = LEN(poly->vertices[i].x,poly->vertices[i].y);
-                   verts[i].x = poly->vertices[i].x * (1.0 + xmargin/h);
-                   verts[i].y = poly->vertices[i].y * (1.0 + ymargin/h);
-                   verts[i].x = PS2INCH(verts[i].x);
-                   verts[i].y = PS2INCH(verts[i].y);
+               else {
+                   for (i = 0; i < sides; i++) {
+#if 0
+                        double h = LEN(poly->vertices[i].x,poly->vertices[i].y);
+                       verts[i].x = poly->vertices[i].x * (1.0 + xmargin/h);
+                       verts[i].y = poly->vertices[i].y * (1.0 + ymargin/h);
+                       verts[i].x = PS2INCH(verts[i].x);
+                       verts[i].y = PS2INCH(verts[i].y);
+fprintf(stderr, "vert=%g,%g h=%g margin=%g,%g\n",
+       verts[i].x, verts[i].y, h, xmargin, ymargin);
+#else
+                       verts[i].x = PS2INCH(poly->vertices[i].x);
+                       verts[i].y = PS2INCH(poly->vertices[i].y);
+#endif
+                   }
                }
            } else
                verts = genRound(n, &sides, xmargin, ymargin);