]> granicus.if.org Git - graphviz/commitdiff
common round_corners: rephrase some open coded 'hypot'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 6 Mar 2022 23:03:38 +0000 (15:03 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Mar 2022 07:33:29 +0000 (23:33 -0800)
lib/common/shapes.c

index c46441c931cbafe6d5e28000d18a3cf90d48ee86..b28810f979fe8ac0f34eef4670a75d5eac814c44 100644 (file)
@@ -11,6 +11,7 @@
 #include <common/render.h>
 #include <common/htmltable.h>
 #include <limits.h>
+#include <math.h>
 #include <stddef.h>
 #include <stdbool.h>
 
@@ -562,7 +563,7 @@ void round_corners(GVJ_t * job, pointf * AF, int sides, int style, int filled)
            p1 = AF[0];
        dx = p1.x - p0.x;
        dy = p1.y - p0.y;
-       d = sqrt(dx * dx + dy * dy);
+       d = hypot(dx, dy);
        rbconst = MIN(rbconst, d / 3.0);
     }
     for (seg = 0; seg < sides; seg++) {
@@ -573,7 +574,7 @@ void round_corners(GVJ_t * job, pointf * AF, int sides, int style, int filled)
            p1 = AF[0];
        dx = p1.x - p0.x;
        dy = p1.y - p0.y;
-       d = sqrt(dx * dx + dy * dy);
+       d = hypot(dx, dy);
        t = rbconst / d;
        if (shape == BOX3D || shape == COMPONENT)
            t /= 3;