PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ BOX3D_combine_BOX3D()

Datum BOX3D_combine_BOX3D ( PG_FUNCTION_ARGS  )

Definition at line 541 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().

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