PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ box2df_distance_leaf_centroid()

static double box2df_distance_leaf_centroid ( const BOX2DF *  a,
const BOX2DF *  b 
)
static

Calculate the centroid->centroid distance between the boxes.

Definition at line 435 of file gserialized_gist_2d.c.

References box2df_overlaps(), and LW_TRUE.

Referenced by gserialized_distance_centroid_2d(), and gserialized_gist_distance_2d().

436 {
437  /* The centroid->centroid distance between the boxes */
438  double a_x = (a->xmax + a->xmin) / 2.0;
439  double a_y = (a->ymax + a->ymin) / 2.0;
440  double b_x = (b->xmax + b->xmin) / 2.0;
441  double b_y = (b->ymax + b->ymin) / 2.0;
442 
443  /* This "distance" is only used for comparisons, */
444  return sqrt((a_x - b_x) * (a_x - b_x) + (a_y - b_y) * (a_y - b_y));
445 }
Here is the call graph for this function:
Here is the caller graph for this function: