From: Matthew Fernandez Date: Wed, 28 Dec 2022 23:08:00 +0000 (-0800) Subject: fdpgen: remove 'Cell2' parameter X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=728119b8e8f53f2b1b89f3fdcaaf6340b38c51db;p=graphviz fdpgen: remove 'Cell2' parameter This parameter was only being set conditionally, based on whether `useGrid` was set, making it look as if the incorrect default value of `0` was being used in some cases. By tracing the code, it was possible to see the only usage of `T_Cell2` was under exactly the same conditions as which it was set, making the use safe. We can remove this complexity by simply removing the parameter entirely and computing it on-demand. --- diff --git a/lib/fdpgen/tlayout.c b/lib/fdpgen/tlayout.c index ea5b847ea..30f9f3ffd 100644 --- a/lib/fdpgen/tlayout.c +++ b/lib/fdpgen/tlayout.c @@ -73,7 +73,6 @@ typedef struct { double T0; /* initial temperature */ int smode; /* seed mode */ double Cell; /* grid cell size */ - double Cell2; /* Cell*Cell */ double K2; /* K*K */ double Wd; /* half-width of boundary */ double Ht; /* half-height of boundary */ @@ -97,7 +96,6 @@ static parms_t parms; #define T_T0 (parms.T0) #define T_smode (parms.smode) #define T_Cell (parms.Cell) -#define T_Cell2 (parms.Cell2) #define T_K2 (parms.K2) #define T_Wd (parms.Wd) #define T_Ht (parms.Ht) @@ -201,7 +199,6 @@ void fdp_initParams(graph_t * g) if (T_useGrid) { if (T_Cell <= 0.0) T_Cell = 3 * T_K; - T_Cell2 = T_Cell * T_Cell; } #ifdef DEBUG if (Verbose) { @@ -275,7 +272,7 @@ static void doNeighbor(Grid * grid, int i, int j, node_list * nodes) xdelta = (ND_pos(q))[0] - (ND_pos(p))[0]; ydelta = (ND_pos(q))[1] - (ND_pos(p))[1]; dist2 = xdelta * xdelta + ydelta * ydelta; - if (dist2 < T_Cell2) + if (dist2 < T_Cell * T_Cell) doRep(p, q, xdelta, ydelta, dist2); } }