PostGIS  2.3.7dev-r@@SVN_REVISION@@
Datum BOX3D_combine_BOX3D ( PG_FUNCTION_ARGS  )

Definition at line 545 of file lwgeom_box3d.c.

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

546 {
547  BOX3D *box0 = (BOX3D*)(PG_ARGISNULL(0) ? NULL : PG_GETARG_POINTER(0));
548  BOX3D *box1 = (BOX3D*)(PG_ARGISNULL(1) ? NULL : PG_GETARG_POINTER(1));
549  BOX3D *result;
550 
551  if (box0 && !box1)
552  PG_RETURN_POINTER(box0);
553 
554  if (box1 && !box0)
555  PG_RETURN_POINTER(box1);
556 
557  if (!box1 && !box0)
558  PG_RETURN_NULL();
559 
560  result = palloc(sizeof(BOX3D));
561  result->xmax = Max(box0->xmax, box1->xmax);
562  result->ymax = Max(box0->ymax, box1->ymax);
563  result->zmax = Max(box0->zmax, box1->zmax);
564  result->xmin = Min(box0->xmin, box1->xmin);
565  result->ymin = Min(box0->ymin, box1->ymin);
566  result->zmin = Min(box0->zmin, box1->zmin);
567  result->srid = box0->srid;
568 
569  PG_RETURN_POINTER(result);
570 }
int32_t srid
Definition: liblwgeom.h:278
double ymin
Definition: liblwgeom.h:276
double xmin
Definition: liblwgeom.h:276
double xmax
Definition: liblwgeom.h:277
double ymax
Definition: liblwgeom.h:277
double zmax
Definition: liblwgeom.h:277
double zmin
Definition: liblwgeom.h:276