From: ellson Date: Mon, 18 Aug 2008 16:42:12 +0000 (+0000) Subject: partial fix for NAN in node bb caculation, and removal of duplicated code. X-Git-Tag: LAST_LIBGRAPH~32^2~3621 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50a087715ced0f0e4edb23b8ee53677180551c46;p=graphviz partial fix for NAN in node bb caculation, and removal of duplicated code. --- diff --git a/lib/neatogen/poly.c b/lib/neatogen/poly.c index 5d83c8144..37da50e69 100644 --- a/lib/neatogen/poly.c +++ b/lib/neatogen/poly.c @@ -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);