From: Matthew Fernandez Date: Sat, 30 Jul 2022 00:52:12 +0000 (-0700) Subject: sparse QuadTree_get_nearest: remove 'flag' parameter X-Git-Tag: 5.0.1~22^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b01f364453a12c6a56b11d3f315170d105273ab5;p=graphviz sparse QuadTree_get_nearest: remove 'flag' parameter This is always set to 0 and conveys no information to the caller. --- diff --git a/cmd/gvmap/make_map.c b/cmd/gvmap/make_map.c index dec68d7e5..20d5de43b 100644 --- a/cmd/gvmap/make_map.c +++ b/cmd/gvmap/make_map.c @@ -1181,8 +1181,7 @@ static int make_map_internal(int exclude_random, int include_OK_points, point[j] = xmin[j] + (xmax[j] - xmin[j])*drand(); } - QuadTree_get_nearest(qt, point, ymin, &imin, &min, flag); - assert(!(*flag)); + QuadTree_get_nearest(qt, point, ymin, &imin, &min); if (min > shore_depth_tol){/* point not too close, accepted */ for (j = 0; j < dim2; j++){ diff --git a/lib/edgepaint/node_distinct_coloring.c b/lib/edgepaint/node_distinct_coloring.c index 64e9d1ca0..a4da5510a 100644 --- a/lib/edgepaint/node_distinct_coloring.c +++ b/lib/edgepaint/node_distinct_coloring.c @@ -37,7 +37,7 @@ static void node_distinct_coloring_internal2(int scheme, QuadTree qt, static const int iter_max = 100; double cspace_size = 0.7; double red[3], black[3], min; - int flag = 0, imin; + int imin; double *wgt = NULL; assert(accuracy > 0); @@ -54,8 +54,7 @@ static void node_distinct_coloring_internal2(int scheme, QuadTree qt, if (n == 1){ if (scheme == COLOR_LAB){ assert(qt); - QuadTree_get_nearest(qt, black, colors, &imin, &min, &flag); - assert(!flag); + QuadTree_get_nearest(qt, black, colors, &imin, &min); LAB2RGB_real_01(colors); *color_diff0 = 1000; *color_diff_sum0 = 1000; } else { @@ -66,12 +65,10 @@ static void node_distinct_coloring_internal2(int scheme, QuadTree qt, } else if (n == 2){ if (scheme == COLOR_LAB){ assert(qt); - QuadTree_get_nearest(qt, black, colors, &imin, &min, &flag); - assert(!flag); + QuadTree_get_nearest(qt, black, colors, &imin, &min); LAB2RGB_real_01(colors); - QuadTree_get_nearest(qt, red, colors+cdim, &imin, &min, &flag); - assert(!flag); + QuadTree_get_nearest(qt, red, colors+cdim, &imin, &min); LAB2RGB_real_01(colors+cdim); *color_diff0 = 1000; *color_diff_sum0 = 1000; diff --git a/lib/sparse/QuadTree.c b/lib/sparse/QuadTree.c index c2d6f1c21..1e5fabb39 100644 --- a/lib/sparse/QuadTree.c +++ b/lib/sparse/QuadTree.c @@ -713,9 +713,8 @@ static void QuadTree_get_nearest_internal(QuadTree qt, double *x, double *y, dou } -void QuadTree_get_nearest(QuadTree qt, double *x, double *ymin, int *imin, double *min, int *flag){ +void QuadTree_get_nearest(QuadTree qt, double *x, double *ymin, int *imin, double *min){ - *flag = 0; *min = -1; QuadTree_get_nearest_internal(qt, x, ymin, min, imin, TRUE); diff --git a/lib/sparse/QuadTree.h b/lib/sparse/QuadTree.h index 2c2f684ec..6e0c7d8fc 100644 --- a/lib/sparse/QuadTree.h +++ b/lib/sparse/QuadTree.h @@ -56,7 +56,7 @@ void QuadTree_get_supernodes(QuadTree qt, double bh, double *point, int nodeid, void QuadTree_get_repulsive_force(QuadTree qt, double *force, double *x, double bh, double p, double KP, double *counts, int *flag); /* find the nearest point and put in ymin, index in imin and distance in min */ -void QuadTree_get_nearest(QuadTree qt, double *x, double *ymin, int *imin, double *min, int *flag); +void QuadTree_get_nearest(QuadTree qt, double *x, double *ymin, int *imin, double *min); QuadTree QuadTree_new_in_quadrant(int dim, double *center, double width, int max_level, int i);