PostGIS  2.5.0dev-r@@SVN_REVISION@@
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.

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().

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 }
double xmax
Definition: liblwgeom.h:292
#define FP_MIN(A, B)
double zmax
Definition: liblwgeom.h:296
double ymin
Definition: liblwgeom.h:293
double xmin
Definition: liblwgeom.h:291
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
double ymax
Definition: liblwgeom.h:294
uint8_t flags
Definition: liblwgeom.h:290
double zmin
Definition: liblwgeom.h:295
#define FP_MAX(A, B)

Here is the caller graph for this function: