PostGIS  2.2.8dev-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 111 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().

112 {
113  if ( ( ! g1 ) && ( ! g2 ) )
114  return LW_FALSE;
115 
116  if ( ! g1 )
117  {
118  memcpy(gout, g2, sizeof(GBOX));
119  return LW_TRUE;
120  }
121  if ( ! g2 )
122  {
123  memcpy(gout, g1, sizeof(GBOX));
124  return LW_TRUE;
125  }
126 
127  gout->flags = g1->flags;
128 
129  gout->xmin = FP_MIN(g1->xmin, g2->xmin);
130  gout->xmax = FP_MAX(g1->xmax, g2->xmax);
131 
132  gout->ymin = FP_MIN(g1->ymin, g2->ymin);
133  gout->ymax = FP_MAX(g1->ymax, g2->ymax);
134 
135  gout->zmin = FP_MIN(g1->zmin, g2->zmin);
136  gout->zmax = FP_MAX(g1->zmax, g2->zmax);
137 
138  return LW_TRUE;
139 }
double xmax
Definition: liblwgeom.h:277
#define FP_MIN(A, B)
double zmax
Definition: liblwgeom.h:281
double ymin
Definition: liblwgeom.h:278
double xmin
Definition: liblwgeom.h:276
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
double ymax
Definition: liblwgeom.h:279
uint8_t flags
Definition: liblwgeom.h:275
double zmin
Definition: liblwgeom.h:280
#define FP_MAX(A, B)
Here is the caller graph for this function: