PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ gidx_contains()

bool gidx_contains ( GIDX *  a,
GIDX *  b 
)

Definition at line 450 of file gserialized_gist_nd.c.

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

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 }
bool gidx_is_unknown(const GIDX *a)
Here is the call graph for this function:
Here is the caller graph for this function: