PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gbox_union()

int gbox_union ( const GBOX g1,
const GBOX g2,
GBOX gout 
)

Update the output GBOX to be large enough to include both inputs.

Definition at line 142 of file g_box.c.

143 {
144  if ( ( ! g1 ) && ( ! g2 ) )
145  return LW_FALSE;
146  else if (!g1)
147  {
148  memcpy(gout, g2, sizeof(GBOX));
149  return LW_TRUE;
150  }
151  else if (!g2)
152  {
153  memcpy(gout, g1, sizeof(GBOX));
154  return LW_TRUE;
155  }
156 
157  gout->flags = g1->flags;
158 
159  gout->xmin = FP_MIN(g1->xmin, g2->xmin);
160  gout->xmax = FP_MAX(g1->xmax, g2->xmax);
161 
162  gout->ymin = FP_MIN(g1->ymin, g2->ymin);
163  gout->ymax = FP_MAX(g1->ymax, g2->ymax);
164 
165  gout->zmin = FP_MIN(g1->zmin, g2->zmin);
166  gout->zmax = FP_MAX(g1->zmax, g2->zmax);
167 
168  return LW_TRUE;
169 }
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
#define FP_MAX(A, B)
#define FP_MIN(A, B)
double ymax
Definition: liblwgeom.h:298
double zmax
Definition: liblwgeom.h:300
double xmax
Definition: liblwgeom.h:296
double zmin
Definition: liblwgeom.h:299
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295
uint8_t flags
Definition: liblwgeom.h:294

References GBOX::flags, FP_MAX, FP_MIN, LW_FALSE, LW_TRUE, GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

Referenced by BOX2D_union(), geography_bestsrid(), and lwt_ChangeEdgeGeom().

Here is the caller graph for this function: