PostGIS  2.3.7dev-r@@SVN_REVISION@@
int lw_dist2d_check_overlap ( LWGEOM lwg1,
LWGEOM lwg2 
)

We have to check for overlapping bboxes.

Definition at line 498 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().

499 {
500  LWDEBUG(2, "lw_dist2d_check_overlap is called");
501  if ( ! lwg1->bbox )
502  lwgeom_calculate_gbox(lwg1, lwg1->bbox);
503  if ( ! lwg2->bbox )
504  lwgeom_calculate_gbox(lwg2, lwg2->bbox);
505 
506  /*Check if the geometries intersect.
507  */
508  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))
509  {
510  LWDEBUG(3, "geometries bboxes did not overlap");
511  return LW_FALSE;
512  }
513  LWDEBUG(3, "geometries bboxes overlap");
514  return LW_TRUE;
515 }
GBOX * bbox
Definition: liblwgeom.h:397
double xmax
Definition: liblwgeom.h:292
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
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:665
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
double ymax
Definition: liblwgeom.h:294

Here is the call graph for this function:

Here is the caller graph for this function: