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

We have to check for overlapping bboxes.

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

459 {
460  LWDEBUG(2, "lw_dist2d_check_overlap is called");
461  if ( ! lwg1->bbox )
462  lwgeom_calculate_gbox(lwg1, lwg1->bbox);
463  if ( ! lwg2->bbox )
464  lwgeom_calculate_gbox(lwg2, lwg2->bbox);
465 
466  /*Check if the geometries intersect.
467  */
468  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))
469  {
470  LWDEBUG(3, "geometries bboxes did not overlap");
471  return LW_FALSE;
472  }
473  LWDEBUG(3, "geometries bboxes overlap");
474  return LW_TRUE;
475 }
GBOX * bbox
Definition: liblwgeom.h:354
double xmax
Definition: liblwgeom.h:249
#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:608
double ymin
Definition: liblwgeom.h:250
double xmin
Definition: liblwgeom.h:248
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
double ymax
Definition: liblwgeom.h:251

Here is the call graph for this function:

Here is the caller graph for this function: