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

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

Definition at line 155 of file g_box.c.

References GBOX::flags, FLAGS_GET_GEODETIC, FLAGS_GET_M, FLAGS_GET_Z, isfinite, 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().

156 {
157  /* X */
158  if ( ! isfinite(gbox->xmin) || isnan(gbox->xmin) ||
159  ! isfinite(gbox->xmax) || isnan(gbox->xmax) )
160  return LW_FALSE;
161 
162  /* Y */
163  if ( ! isfinite(gbox->ymin) || isnan(gbox->ymin) ||
164  ! isfinite(gbox->ymax) || isnan(gbox->ymax) )
165  return LW_FALSE;
166 
167  /* Z */
168  if ( FLAGS_GET_GEODETIC(gbox->flags) || FLAGS_GET_Z(gbox->flags) )
169  {
170  if ( ! isfinite(gbox->zmin) || isnan(gbox->zmin) ||
171  ! isfinite(gbox->zmax) || isnan(gbox->zmax) )
172  return LW_FALSE;
173  }
174 
175  /* M */
176  if ( FLAGS_GET_M(gbox->flags) )
177  {
178  if ( ! isfinite(gbox->mmin) || isnan(gbox->mmin) ||
179  ! isfinite(gbox->mmax) || isnan(gbox->mmax) )
180  return LW_FALSE;
181  }
182 
183  return LW_TRUE;
184 }
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:109
double xmax
Definition: liblwgeom.h:249
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
#define isfinite
Definition: g_box.c:17
double ymax
Definition: liblwgeom.h:251
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
uint8_t flags
Definition: liblwgeom.h:247
double mmin
Definition: liblwgeom.h:254
double zmin
Definition: liblwgeom.h:252
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:107
double mmax
Definition: liblwgeom.h:255

Here is the caller graph for this function: