PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ BOX2D_intersects()

Datum BOX2D_intersects ( PG_FUNCTION_ARGS  )

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

322 {
323  GBOX *a = (GBOX *) PG_GETARG_POINTER(0);
324  GBOX *b = (GBOX *) PG_GETARG_POINTER(1);
325  GBOX *n;
326 
327 
328  n = (GBOX *) palloc(sizeof(GBOX));
329 
330  n->xmax = Min(a->xmax, b->xmax);
331  n->ymax = Min(a->ymax, b->ymax);
332  n->xmin = Max(a->xmin, b->xmin);
333  n->ymin = Max(a->ymin, b->ymin);
334 
335 
336  if (n->xmax < n->xmin || n->ymax < n->ymin)
337  {
338  pfree(n);
339  /* Indicate "no intersection" by returning NULL pointer */
340  n = NULL;
341  }
342 
343  PG_RETURN_POINTER(n);
344 }
double xmax
Definition: liblwgeom.h:277
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
double ymax
Definition: liblwgeom.h:279
Here is the call graph for this function:
Here is the caller graph for this function: