PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lw_dist2d_check_overlap()

int lw_dist2d_check_overlap ( LWGEOM lwg1,
LWGEOM lwg2 

We have to check for overlapping bboxes.

Definition at line 484 of file measures.c.

References LWGEOM::bbox, LW_FALSE, LW_TRUE, LWDEBUG, lwgeom_calculate_gbox(), GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by lw_dist2d_recursive().

485 {
486  LWDEBUG(2, "lw_dist2d_check_overlap is called");
487  if ( ! lwg1->bbox )
488  lwgeom_calculate_gbox(lwg1, lwg1->bbox);
489  if ( ! lwg2->bbox )
490  lwgeom_calculate_gbox(lwg2, lwg2->bbox);
492  /*Check if the geometries intersect.
493  */
494  if ((lwg1->bbox->xmax<lwg2->bbox->xmin||lwg1->bbox->xmin>lwg2->bbox->xmax||lwg1->bbox->ymax<lwg2->bbox->ymin||lwg1->bbox->ymin>lwg2->bbox->ymax))
495  {
496  LWDEBUG(3, "geometries bboxes did not overlap");
497  return LW_FALSE;
498  }
499  LWDEBUG(3, "geometries bboxes overlap");
500  return LW_TRUE;
501 }
GBOX * bbox
Definition: liblwgeom.h:382
double xmax
Definition: liblwgeom.h:277
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
int lwgeom_calculate_gbox(const LWGEOM *lwgeom, GBOX *gbox)
Calculate bounding box of a geometry, automatically taking into account whether it is cartesian or ge...
Definition: lwgeom.c:652
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
double ymax
Definition: liblwgeom.h:279
Here is the call graph for this function:
Here is the caller graph for this function: