PostGIS  2.3.6-r@@SVN_REVISION@@
Datum BOX2D_intersects ( PG_FUNCTION_ARGS  )

Definition at line 335 of file lwgeom_box.c.

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

336 {
337  GBOX *a = (GBOX *) PG_GETARG_POINTER(0);
338  GBOX *b = (GBOX *) PG_GETARG_POINTER(1);
339  GBOX *n;
340 
341 
342  n = (GBOX *) palloc(sizeof(GBOX));
343 
344  n->xmax = Min(a->xmax, b->xmax);
345  n->ymax = Min(a->ymax, b->ymax);
346  n->xmin = Max(a->xmin, b->xmin);
347  n->ymin = Max(a->ymin, b->ymin);
348 
349 
350  if (n->xmax < n->xmin || n->ymax < n->ymin)
351  {
352  pfree(n);
353  /* Indicate "no intersection" by returning NULL pointer */
354  n = NULL;
355  }
356 
357  PG_RETURN_POINTER(n);
358 }
double xmax
Definition: liblwgeom.h:292
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
double ymax
Definition: liblwgeom.h:294