From: Matthew Fernandez Date: Wed, 28 Dec 2022 23:12:48 +0000 (-0800) Subject: fdpgen: remove 'Ht2' parameter X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fc93cb8b8e69bbee17c94b95e94f3c0a16a2508;p=graphviz fdpgen: remove 'Ht2' parameter Without tracing the code, it was challenging to see that `Ht2` was always being set consistently to evaluate to `Ht * Ht`. 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 fd99f2d02..f9d549e0e 100644 --- a/lib/fdpgen/tlayout.c +++ b/lib/fdpgen/tlayout.c @@ -76,7 +76,6 @@ typedef struct { double K2; /* K*K */ double Wd; /* half-width of boundary */ double Ht; /* half-height of boundary */ - double Ht2; /* Ht*Ht */ int pass1; /* iterations used in pass 1 */ int loopcnt; /* actual iterations in this pass */ } parms_t; @@ -98,7 +97,6 @@ static parms_t parms; #define T_K2 (parms.K2) #define T_Wd (parms.Wd) #define T_Ht (parms.Ht) -#define T_Ht2 (parms.Ht2) #define T_pass1 (parms.pass1) #define T_loopcnt (parms.loopcnt) @@ -369,7 +367,7 @@ static void updatePos(Agraph_t * g, double temp, bport_t * pp) /* if ports, limit by boundary */ if (pp) { - d = sqrt(x * x / (T_Wd * T_Wd) + y * y / T_Ht2); + d = sqrt(x * x / (T_Wd * T_Wd) + y * y / (T_Ht * T_Ht)); if (IS_PORT(n)) { ND_pos(n)[0] = x / d; ND_pos(n)[1] = y / d; @@ -520,7 +518,6 @@ static pointf initPositions(graph_t * g, bport_t * pp) } else { ctr.x = ctr.y = 0; } - T_Ht2 = T_Ht * T_Ht; /* Set seed value */ if (T_smode == INIT_RANDOM)