PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gidx_inter_volume()

static float gidx_inter_volume ( GIDX *  a,
GIDX *  b 
)
static

Definition at line 366 of file gserialized_gist_nd.c.

367 {
368  uint32_t i;
369  float result;
370 
371  POSTGIS_DEBUG(5,"entered function");
372 
373  if ( a == NULL || b == NULL )
374  {
375  elog(ERROR, "gidx_inter_volume received a null argument");
376  return 0.0;
377  }
378 
379  if ( gidx_is_unknown(a) || gidx_is_unknown(b) )
380  {
381  return 0.0;
382  }
383 
384  /* Ensure 'a' has the most dimensions. */
386 
387  /* Initialize with minimal length of first dimension. */
388  result = Min(GIDX_GET_MAX(a,0),GIDX_GET_MAX(b,0)) - Max(GIDX_GET_MIN(a,0),GIDX_GET_MIN(b,0));
389 
390  /* If they are disjoint (max < min) then return zero. */
391  if ( result < 0.0 ) return 0.0;
392 
393  /* Continue for remaining dimensions. */
394  for ( i = 1; i < GIDX_NDIMS(b); i++ )
395  {
396  float width = Min(GIDX_GET_MAX(a,i),GIDX_GET_MAX(b,i)) - Max(GIDX_GET_MIN(a,i),GIDX_GET_MIN(b,i));
397  if ( width < 0.0 ) return 0.0;
398  /* Multiply by minimal length of remaining dimensions. */
399  result *= width;
400  }
401  POSTGIS_DEBUGF(5, "volume( %s intersection %s ) = %.12g", gidx_to_string(a), gidx_to_string(b), result);
402  return result;
403 }
bool gidx_is_unknown(const GIDX *a)
static void gidx_dimensionality_check(GIDX **a, GIDX **b)
unsigned int uint32_t
Definition: uthash.h:78

References gidx_dimensionality_check(), and gidx_is_unknown().

Referenced by gserialized_gist_picksplit_constructsplit().

Here is the call graph for this function:
Here is the caller graph for this function: