]> granicus.if.org Git - graphviz/commitdiff
libmingle force_directed_edge_bundling: rephrase an open coded 'hypot'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Mar 2022 22:56:01 +0000 (14:56 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Mar 2022 07:33:29 +0000 (23:33 -0800)
lib/mingle/edge_bundling.cpp

index 098e810bd0e8fc52cc62edd25603f37ba173f3bd..fe3b9b3ca6ec0cc8c4f42a415ede3f557a6b7e5f 100644 (file)
@@ -482,7 +482,9 @@ static pedge* force_directed_edge_bundling(SparseMatrix A, pedge* edges, int max
 
       for (j = 1; j <= np - 2; j++){
        for (k = 0; k < dim; k++) {
-         x[j*dim + k] += step*edge_length*(force_t[j*dim+k] + K*force_a[j*dim+k])/(sqrt(fnorm_t*fnorm_t + K*K*fnorm_a*fnorm_a));
+         x[j * dim + k] += step * edge_length
+                         * (force_t[j * dim + k] + K * force_a[j * dim+k])
+                         / hypot(fnorm_t, K * fnorm_a);
        }
       }