PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ BOX2D_intersects()

Datum BOX2D_intersects ( PG_FUNCTION_ARGS  )

Definition at line 344 of file lwgeom_box.c.

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

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