PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ BOX3D_combine_BOX3D()

Datum BOX3D_combine_BOX3D ( PG_FUNCTION_ARGS  )

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

523 {
524  BOX3D *box0 = (BOX3D *)(PG_ARGISNULL(0) ? NULL : PG_GETARG_POINTER(0));
525  BOX3D *box1 = (BOX3D *)(PG_ARGISNULL(1) ? NULL : PG_GETARG_POINTER(1));
526  BOX3D *result;
527 
528  if (box0 && !box1)
529  PG_RETURN_POINTER(box0);
530 
531  if (box1 && !box0)
532  PG_RETURN_POINTER(box1);
533 
534  if (!box1 && !box0)
535  PG_RETURN_NULL();
536 
537  result = palloc(sizeof(BOX3D));
538  result->xmax = Max(box0->xmax, box1->xmax);
539  result->ymax = Max(box0->ymax, box1->ymax);
540  result->zmax = Max(box0->zmax, box1->zmax);
541  result->xmin = Min(box0->xmin, box1->xmin);
542  result->ymin = Min(box0->ymin, box1->ymin);
543  result->zmin = Min(box0->zmin, box1->zmin);
544  result->srid = box0->srid;
545 
546  PG_RETURN_POINTER(result);
547 }
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: