PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gidx_contains()

bool gidx_contains ( GIDX *  a,
GIDX *  b 
)

Definition at line 451 of file gserialized_gist_nd.c.

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

References gidx_is_unknown().

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().

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