PostGIS  2.4.9dev-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 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:143
double xmax
Definition: liblwgeom.h:293
double zmax
Definition: liblwgeom.h:297
double ymin
Definition: liblwgeom.h:294
double xmin
Definition: liblwgeom.h:292
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
double ymax
Definition: liblwgeom.h:295
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
uint8_t flags
Definition: liblwgeom.h:291
double mmin
Definition: liblwgeom.h:298
double zmin
Definition: liblwgeom.h:296
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
double mmax
Definition: liblwgeom.h:299
Here is the caller graph for this function: