From: erg Date: Thu, 9 Sep 2010 19:29:40 +0000 (+0000) Subject: Fix and simplify ortho code X-Git-Tag: LAST_LIBGRAPH~32^2~1189 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6af664ef2b9d03871e137f2d65acc8e175220a9c;p=graphviz Fix and simplify ortho code --- diff --git a/lib/ortho/ortho.c b/lib/ortho/ortho.c index 97d29f440..5ba1ca8a1 100644 --- a/lib/ortho/ortho.c +++ b/lib/ortho/ortho.c @@ -1197,7 +1197,7 @@ attachOrthoEdges (Agraph_t* g, maze* mp, int n_edges, route* route_list, splineI } ispline[ipt] = ispline[ipt+1] = p; if (Verbose > 1) - fprintf(stderr, "ortho %s %s\n", agnameof(agtail(e)),agnameof(aghead(e))); + fprintf(stderr, "ortho %s %s\n", agnameof(agtail(e)),agnameof(aghead(e))); clip_and_install(e, aghead(e), ispline, npts, sinfo); if (doLbls && (lbl = ED_label(e)) && !lbl->set) addEdgeLabels(g, e, p1, q1); diff --git a/lib/ortho/ortho.h b/lib/ortho/ortho.h index 6c90573c8..eed1e7172 100644 --- a/lib/ortho/ortho.h +++ b/lib/ortho/ortho.h @@ -19,4 +19,4 @@ #include void orthoEdges (Agraph_t* g, int useLbls); -#endif \ No newline at end of file +#endif diff --git a/lib/ortho/partition.c b/lib/ortho/partition.c index 36d627106..5f8996d34 100644 --- a/lib/ortho/partition.c +++ b/lib/ortho/partition.c @@ -50,9 +50,6 @@ extern double drand48(void); #endif - - - typedef struct { int vnum; int next; /* Circularly linked list */ @@ -162,8 +159,7 @@ generateRandomOrdering(int n, int* permute) for (i = 0; i <= n; i++) permute[i] = i; for (i = 1; i <= n; i++) { - double tempa=drand48(); - j = i + tempa * (n + 1 - i); + j = i + drand48() * (n + 1 - i); if (j != i) { tmp = permute[i]; permute [i] = permute[j]; diff --git a/lib/ortho/trapezoid.c b/lib/ortho/trapezoid.c index 7412df04a..b56a7ab17 100644 --- a/lib/ortho/trapezoid.c +++ b/lib/ortho/trapezoid.c @@ -29,6 +29,10 @@ #include #include +#ifdef WIN32 +#define log2(x) (log(x)/log(2)) +#endif + /* Node types */ #define T_X 1 @@ -1023,12 +1027,7 @@ static int math_logstar_n(int n) double v; for (i = 0, v = (double) n; v >= 1; i++) -#ifndef WIN32 v = log2(v); -#else - v = log(v)/log(2); - -#endif return (i - 1); } @@ -1039,13 +1038,7 @@ static int math_N(int n, int h) double v; for (i = 0, v = (int) n; i < h; i++) -#ifndef WIN32 v = log2(v); -#else - v = log(v)/log(2); - -#endif - return (int) ceil((double) 1.0*n/v); }