PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gidx_contains()

bool gidx_contains ( GIDX *  a,
GIDX *  b 
)

Definition at line 450 of file gserialized_gist_nd.c.

References FALSE, gidx_is_unknown(), and TRUE.

Referenced by gidx_brin_inclusion_add_value(), gserialized_contains(), gserialized_gidx_geom_contains(), gserialized_gidx_geom_within(), gserialized_gidx_gidx_contains(), gserialized_gidx_gidx_within(), gserialized_gist_consistent_internal(), gserialized_gist_consistent_leaf(), and gserialized_within().

451 {
452  int i, dims_a, dims_b;
453 
454  POSTGIS_DEBUG(5, "entered function");
455 
456  if ( (a == NULL) || (b == NULL) ) return FALSE;
457 
458  if ( gidx_is_unknown(a) || gidx_is_unknown(b) )
459  return FALSE;
460 
461  dims_a = GIDX_NDIMS(a);
462  dims_b = GIDX_NDIMS(b);
463 
464  if ( dims_a < dims_b )
465  {
466  /*
467  ** If (b) is of higher dimensionality than (a) it can only be contained
468  ** if those higher dimensions are zeroes.
469  */
470  for (i = dims_a; i < dims_b; i++)
471  {
472  if ( GIDX_GET_MIN(b,i) != 0 )
473  return FALSE;
474  if ( GIDX_GET_MAX(b,i) != 0 )
475  return FALSE;
476  }
477  }
478 
479  /* Excess dimensions of (a), don't matter, it just has to contain (b) in (b)'s dimensions */
480  for (i = 0; i < Min(dims_a, dims_b); i++)
481  {
482  if ( GIDX_GET_MIN(a,i) > GIDX_GET_MIN(b,i) )
483  return FALSE;
484  if ( GIDX_GET_MAX(a,i) < GIDX_GET_MAX(b,i) )
485  return FALSE;
486  }
487 
488  return TRUE;
489 }
static bool gidx_is_unknown(const GIDX *a)
#define FALSE
Definition: dbfopen.c:168
#define TRUE
Definition: dbfopen.c:169
Here is the call graph for this function:
Here is the caller graph for this function: