PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ BOX3D_combine_BOX3D()

Datum BOX3D_combine_BOX3D ( PG_FUNCTION_ARGS  )

Definition at line 523 of file lwgeom_box3d.c.

524 {
525  BOX3D *box0 = (BOX3D *)(PG_ARGISNULL(0) ? NULL : PG_GETARG_POINTER(0));
526  BOX3D *box1 = (BOX3D *)(PG_ARGISNULL(1) ? NULL : PG_GETARG_POINTER(1));
527  BOX3D *result;
528 
529  if (box0 && !box1)
530  PG_RETURN_POINTER(box0);
531 
532  if (box1 && !box0)
533  PG_RETURN_POINTER(box1);
534 
535  if (!box1 && !box0)
536  PG_RETURN_NULL();
537 
538  result = palloc(sizeof(BOX3D));
539  result->xmax = Max(box0->xmax, box1->xmax);
540  result->ymax = Max(box0->ymax, box1->ymax);
541  result->zmax = Max(box0->zmax, box1->zmax);
542  result->xmin = Min(box0->xmin, box1->xmin);
543  result->ymin = Min(box0->ymin, box1->ymin);
544  result->zmin = Min(box0->zmin, box1->zmin);
545  result->srid = box0->srid;
546 
547  PG_RETURN_POINTER(result);
548 }
double xmax
Definition: liblwgeom.h:281
double zmin
Definition: liblwgeom.h:280
double ymax
Definition: liblwgeom.h:281
double ymin
Definition: liblwgeom.h:280
double zmax
Definition: liblwgeom.h:281
double xmin
Definition: liblwgeom.h:280
int32_t srid
Definition: liblwgeom.h:282

References BOX3D::srid, BOX3D::xmax, BOX3D::xmin, BOX3D::ymax, BOX3D::ymin, BOX3D::zmax, and BOX3D::zmin.