PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ BOX2D_intersects()

Datum BOX2D_intersects ( PG_FUNCTION_ARGS  )

Definition at line 343 of file lwgeom_box.c.

344 {
345  GBOX *a = (GBOX *) PG_GETARG_POINTER(0);
346  GBOX *b = (GBOX *) PG_GETARG_POINTER(1);
347  GBOX *n;
348 
349 
350  n = (GBOX *) palloc(sizeof(GBOX));
351 
352  n->xmax = Min(a->xmax, b->xmax);
353  n->ymax = Min(a->ymax, b->ymax);
354  n->xmin = Max(a->xmin, b->xmin);
355  n->ymin = Max(a->ymin, b->ymin);
356 
357 
358  if (n->xmax < n->xmin || n->ymax < n->ymin)
359  {
360  pfree(n);
361  /* Indicate "no intersection" by returning NULL pointer */
362  n = NULL;
363  }
364 
365  PG_RETURN_POINTER(n);
366 }
double ymax
Definition: liblwgeom.h:298
double xmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295

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