PostGIS  2.4.9dev-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 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:398
double xmax
Definition: liblwgeom.h:293
#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:701
double ymin
Definition: liblwgeom.h:294
double xmin
Definition: liblwgeom.h:292
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
double ymax
Definition: liblwgeom.h:295
Here is the call graph for this function:
Here is the caller graph for this function: