PostGIS  2.3.6-r@@SVN_REVISION@@
int gbox_is_valid ( const GBOX gbox)

Return false if any of the dimensions is NaN or infinite.

Definition at line 209 of file g_box.c.

References GBOX::flags, FLAGS_GET_GEODETIC, FLAGS_GET_M, FLAGS_GET_Z, LW_FALSE, LW_TRUE, GBOX::mmax, GBOX::mmin, GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

Referenced by compute_gserialized_stats_mode().

210 {
211  /* X */
212  if ( ! isfinite(gbox->xmin) || isnan(gbox->xmin) ||
213  ! isfinite(gbox->xmax) || isnan(gbox->xmax) )
214  return LW_FALSE;
215 
216  /* Y */
217  if ( ! isfinite(gbox->ymin) || isnan(gbox->ymin) ||
218  ! isfinite(gbox->ymax) || isnan(gbox->ymax) )
219  return LW_FALSE;
220 
221  /* Z */
222  if ( FLAGS_GET_GEODETIC(gbox->flags) || FLAGS_GET_Z(gbox->flags) )
223  {
224  if ( ! isfinite(gbox->zmin) || isnan(gbox->zmin) ||
225  ! isfinite(gbox->zmax) || isnan(gbox->zmax) )
226  return LW_FALSE;
227  }
228 
229  /* M */
230  if ( FLAGS_GET_M(gbox->flags) )
231  {
232  if ( ! isfinite(gbox->mmin) || isnan(gbox->mmin) ||
233  ! isfinite(gbox->mmax) || isnan(gbox->mmax) )
234  return LW_FALSE;
235  }
236 
237  return LW_TRUE;
238 }
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:142
double xmax
Definition: liblwgeom.h:292
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
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
uint8_t flags
Definition: liblwgeom.h:290
double mmin
Definition: liblwgeom.h:297
double zmin
Definition: liblwgeom.h:295
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
double mmax
Definition: liblwgeom.h:298

Here is the caller graph for this function: