]> granicus.if.org Git - graphviz/commitdiff
abbreviate some manual fmaxf and fminf operations
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 17 May 2021 02:29:07 +0000 (19:29 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 29 May 2021 00:57:39 +0000 (17:57 -0700)
cmd/smyrna/trackball.c

index 91f87ace3fb4743b1b7aaa117a5e76eb8663ab51..9c0f61bf312d9136baff0246a2c4271f54c6c705 100644 (file)
@@ -181,10 +181,8 @@ void trackball(float q[4], float p1x, float p1y, float p2x, float p2y)
     /*
      * Avoid problems with out-of-control values...
      */
-    if (t > 1.0f)
-       t = 1.0f;
-    if (t < -1.0f)
-       t = -1.0f;
+    t = fminf(t, 1.0f);
+    t = fmaxf(t, -1.0f);
     phi = 2.0f * asinf(t);
 
     axis_to_quat(a, phi, q);