PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ BOX2D_intersects()

Datum BOX2D_intersects ( PG_FUNCTION_ARGS  )

Definition at line 343 of file lwgeom_box.c.

References BOX2D_union(), PG_FUNCTION_INFO_V1(), GBOX::xmax, GBOX::xmin, GBOX::ymax, and GBOX::ymin.

Referenced by BOX2D_contain().

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 xmax
Definition: liblwgeom.h:293
double ymin
Definition: liblwgeom.h:294
double xmin
Definition: liblwgeom.h:292
double ymax
Definition: liblwgeom.h:295
Here is the call graph for this function:
Here is the caller graph for this function: