PostGIS  2.5.7dev-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 502 of file measures.c.

503 {
504  LWDEBUG(2, "lw_dist2d_check_overlap is called");
505  if ( ! lwg1->bbox )
506  lwgeom_calculate_gbox(lwg1, lwg1->bbox);
507  if ( ! lwg2->bbox )
508  lwgeom_calculate_gbox(lwg2, lwg2->bbox);
509 
510  /*Check if the geometries intersect.
511  */
512  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))
513  {
514  LWDEBUG(3, "geometries bboxes did not overlap");
515  return LW_FALSE;
516  }
517  LWDEBUG(3, "geometries bboxes overlap");
518  return LW_TRUE;
519 }
#define LW_FALSE
Definition: liblwgeom.h:77
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:746
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
double ymax
Definition: liblwgeom.h:298
double xmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295
GBOX * bbox
Definition: liblwgeom.h:401

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

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