From 1e0a27d699b7f22e4d6444a9038a562db5830c8e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 7 Sep 2022 17:27:49 -0700 Subject: [PATCH] dotgen leftOf: perform computation in double range It is not clear to me why this code was implicitly converting the result of its computation to `int`. Doing the entire thing in `double` is more precise and squashes a compiler warning. --- lib/dotgen/dotsplines.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/dotgen/dotsplines.c b/lib/dotgen/dotsplines.c index 15c194755..5d35c588f 100644 --- a/lib/dotgen/dotsplines.c +++ b/lib/dotgen/dotsplines.c @@ -1677,10 +1677,7 @@ make_flat_edge(graph_t* g, spline_info_t* sp, path * P, edge_t ** edges, int ind static int leftOf (pointf p1, pointf p2, pointf p3) { - int d; - - d = (p1.y - p2.y) * (p3.x - p2.x) - (p3.y - p2.y) * (p1.x - p2.x); - return d > 0; + return (p1.y - p2.y) * (p3.x - p2.x) - (p3.y - p2.y) * (p1.x - p2.x) > 0; } /* makeLineEdge: -- 2.40.0