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

◆ BOX2D_intersects()

Datum BOX2D_intersects ( PG_FUNCTION_ARGS  )

Definition at line 341 of file lwgeom_box.c.

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

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