PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gidx_union_edge()

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

Definition at line 314 of file gserialized_gist_nd.c.

315 {
316  float result;
317  int i;
318  int ndims_a, ndims_b;
319 
320  POSTGIS_DEBUG(5,"entered function");
321 
322  if ( a == NULL && b == NULL )
323  {
324  elog(ERROR, "gidx_union_edge received two null arguments");
325  return 0.0;
326  }
327 
328  if ( a == NULL || gidx_is_unknown(a) )
329  return gidx_volume(b);
330 
331  if ( b == NULL || gidx_is_unknown(b) )
332  return gidx_volume(a);
333 
334  if ( gidx_is_unknown(a) && gidx_is_unknown(b) )
335  {
336  return 0.0;
337  }
338 
339  /* Ensure 'a' has the most dimensions. */
341 
342  ndims_a = GIDX_NDIMS(a);
343  ndims_b = GIDX_NDIMS(b);
344 
345  /* Initialize with maximal length of first dimension. */
346  result = Max(GIDX_GET_MAX(a,0),GIDX_GET_MAX(b,0)) - Min(GIDX_GET_MIN(a,0),GIDX_GET_MIN(b,0));
347 
348  /* Add maximal length of remaining dimensions. */
349  for ( i = 1; i < ndims_b; i++ )
350  {
351  result += (Max(GIDX_GET_MAX(a,i),GIDX_GET_MAX(b,i)) - Min(GIDX_GET_MIN(a,i),GIDX_GET_MIN(b,i)));
352  }
353 
354  /* Add in dimensions of higher dimensional box. */
355  for ( i = ndims_b; i < ndims_a; i++ )
356  {
357  result += (GIDX_GET_MAX(a,i) - GIDX_GET_MIN(a,i));
358  }
359 
360  POSTGIS_DEBUGF(5, "edge( %s union %s ) = %.12g", gidx_to_string(a), gidx_to_string(b), result);
361 
362  return result;
363 }
bool gidx_is_unknown(const GIDX *a)
static float gidx_volume(GIDX *a)
static void gidx_dimensionality_check(GIDX **a, GIDX **b)

References gidx_dimensionality_check(), gidx_is_unknown(), and gidx_volume().

Referenced by gserialized_gist_penalty().

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