PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ BOX3D_combine_BOX3D()

Datum BOX3D_combine_BOX3D ( PG_FUNCTION_ARGS  )

Definition at line 543 of file lwgeom_box3d.c.

References BOX3D_construct(), PG_FUNCTION_INFO_V1(), BOX3D::srid, BOX3D::xmax, BOX3D::xmin, BOX3D::ymax, BOX3D::ymin, BOX3D::zmax, and BOX3D::zmin.

Referenced by BOX3D_combine().

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