PostGIS  2.1.10dev-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 109 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(), and geography_bestsrid().

110 {
111  if ( ( ! g1 ) && ( ! g2 ) )
112  return LW_FALSE;
113 
114  if ( ! g1 )
115  {
116  memcpy(gout, g2, sizeof(GBOX));
117  return LW_TRUE;
118  }
119  if ( ! g2 )
120  {
121  memcpy(gout, g1, sizeof(GBOX));
122  return LW_TRUE;
123  }
124 
125  gout->flags = g1->flags;
126 
127  gout->xmin = FP_MIN(g1->xmin, g2->xmin);
128  gout->xmax = FP_MAX(g1->xmax, g2->xmax);
129 
130  gout->ymin = FP_MIN(g1->ymin, g2->ymin);
131  gout->ymax = FP_MAX(g1->ymax, g2->ymax);
132 
133  gout->zmin = FP_MIN(g1->zmin, g2->zmin);
134  gout->zmax = FP_MAX(g1->zmax, g2->zmax);
135 
136  return LW_TRUE;
137 }
double xmax
Definition: liblwgeom.h:249
#define FP_MIN(A, B)
double zmax
Definition: liblwgeom.h:253
double ymin
Definition: liblwgeom.h:250
double xmin
Definition: liblwgeom.h:248
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
double ymax
Definition: liblwgeom.h:251
uint8_t flags
Definition: liblwgeom.h:247
double zmin
Definition: liblwgeom.h:252
#define FP_MAX(A, B)

Here is the caller graph for this function: