From: Emden Gansner Date: Fri, 7 Oct 2011 14:54:34 +0000 (-0400) Subject: Enable beautify feature in sfdp. This tries to draw leaf nodes uniformly on a circle X-Git-Tag: LAST_LIBGRAPH~32^2~650 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba776ee9271f6af1efec836d4193a621b65b9852;p=graphviz Enable beautify feature in sfdp. This tries to draw leaf nodes uniformly on a circle around root node. --- diff --git a/lib/sfdpgen/sfdpinit.c b/lib/sfdpgen/sfdpinit.c index d036d3d03..669c6e2ad 100644 --- a/lib/sfdpgen/sfdpinit.c +++ b/lib/sfdpgen/sfdpinit.c @@ -306,6 +306,7 @@ tuneControl (graph_t* g, spring_electrical_control ctrl) ctrl->tscheme = late_quadtree_scheme(g, agfindgraphattr(g, "quadtree"), QUAD_TREE_NORMAL); /* ctrl->method = late_mode(g, agfindgraphattr(g, "mode"), METHOD_SPRING_ELECTRICAL); */ ctrl->method = METHOD_SPRING_ELECTRICAL; + ctrl->beautify_leaves = mapBool (agget(g, "beautify"), FALSE); ctrl->rotation = late_double(g, agfindgraphattr(g, "rotation"), 0.0, -MAXDOUBLE); ctrl->edge_labeling_scheme = late_int(g, agfindgraphattr(g, "label_scheme"), 0, 0); if (ctrl->edge_labeling_scheme > 4) { diff --git a/lib/sfdpgen/spring_electrical.c b/lib/sfdpgen/spring_electrical.c index 28d70a3cd..e85a05358 100644 --- a/lib/sfdpgen/spring_electrical.c +++ b/lib/sfdpgen/spring_electrical.c @@ -413,6 +413,7 @@ static void beautify_leaves(int dim, SparseMatrix A, real *x){ pad = MAX(maxang - PI*0.166667*(nleaves-1), 0)*0.5; ang1 += pad*0.95; ang2 -= pad*0.95; +ang1 = 0; ang2 = 2*PI; maxang = 2*PI; assert(ang2 >= ang1); step = 0.; if (nleaves > 1) step = (ang2 - ang1)/(nleaves - 1);