PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ gbox_is_valid()

int gbox_is_valid ( const GBOX gbox)

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

Definition at line 204 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().

205 {
206  /* X */
207  if ( ! isfinite(gbox->xmin) || isnan(gbox->xmin) ||
208  ! isfinite(gbox->xmax) || isnan(gbox->xmax) )
209  return LW_FALSE;
210 
211  /* Y */
212  if ( ! isfinite(gbox->ymin) || isnan(gbox->ymin) ||
213  ! isfinite(gbox->ymax) || isnan(gbox->ymax) )
214  return LW_FALSE;
215 
216  /* Z */
217  if ( FLAGS_GET_GEODETIC(gbox->flags) || FLAGS_GET_Z(gbox->flags) )
218  {
219  if ( ! isfinite(gbox->zmin) || isnan(gbox->zmin) ||
220  ! isfinite(gbox->zmax) || isnan(gbox->zmax) )
221  return LW_FALSE;
222  }
223 
224  /* M */
225  if ( FLAGS_GET_M(gbox->flags) )
226  {
227  if ( ! isfinite(gbox->mmin) || isnan(gbox->mmin) ||
228  ! isfinite(gbox->mmax) || isnan(gbox->mmax) )
229  return LW_FALSE;
230  }
231 
232  return LW_TRUE;
233 }
#define FLAGS_GET_GEODETIC(flags)
Definition: liblwgeom.h:142
double xmax
Definition: liblwgeom.h:295
double zmax
Definition: liblwgeom.h:299
double ymin
Definition: liblwgeom.h:296
double xmin
Definition: liblwgeom.h:294
#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:297
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
uint8_t flags
Definition: liblwgeom.h:293
double mmin
Definition: liblwgeom.h:300
double zmin
Definition: liblwgeom.h:298
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:140
double mmax
Definition: liblwgeom.h:301
Here is the caller graph for this function: