PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum BOX2D_intersects ( PG_FUNCTION_ARGS  )

Definition at line 301 of file lwgeom_box.c.

References GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

302 {
303  GBOX *a = (GBOX *) PG_GETARG_POINTER(0);
304  GBOX *b = (GBOX *) PG_GETARG_POINTER(1);
305  GBOX *n;
306 
307 
308  n = (GBOX *) palloc(sizeof(GBOX));
309 
310  n->xmax = Min(a->xmax, b->xmax);
311  n->ymax = Min(a->ymax, b->ymax);
312  n->xmin = Max(a->xmin, b->xmin);
313  n->ymin = Max(a->ymin, b->ymin);
314 
315 
316  if (n->xmax < n->xmin || n->ymax < n->ymin)
317  {
318  pfree(n);
319  /* Indicate "no intersection" by returning NULL pointer */
320  n = NULL;
321  }
322 
323  PG_RETURN_POINTER(n);
324 }
double xmax
Definition: liblwgeom.h:249
double ymin
Definition: liblwgeom.h:250
double xmin
Definition: liblwgeom.h:248
double ymax
Definition: liblwgeom.h:251