PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gbox_float_round()

void gbox_float_round ( GBOX gbox)

Round given GBOX to float boundaries.

This turns a GBOX into the version it would become after a serialize/deserialize round trip.

Definition at line 712 of file g_box.c.

713 {
714  gbox->xmin = next_float_down(gbox->xmin);
715  gbox->xmax = next_float_up(gbox->xmax);
716 
717  gbox->ymin = next_float_down(gbox->ymin);
718  gbox->ymax = next_float_up(gbox->ymax);
719 
720  if ( FLAGS_GET_M(gbox->flags) )
721  {
722  gbox->mmin = next_float_down(gbox->mmin);
723  gbox->mmax = next_float_up(gbox->mmax);
724  }
725 
726  if ( FLAGS_GET_Z(gbox->flags) )
727  {
728  gbox->zmin = next_float_down(gbox->zmin);
729  gbox->zmax = next_float_up(gbox->zmax);
730  }
731 }
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:141
float next_float_up(double d)
Definition: lwgeom_api.c:73
float next_float_down(double d)
Definition: lwgeom_api.c:52
double ymax
Definition: liblwgeom.h:298
double zmax
Definition: liblwgeom.h:300
double xmax
Definition: liblwgeom.h:296
double zmin
Definition: liblwgeom.h:299
double mmax
Definition: liblwgeom.h:302
double ymin
Definition: liblwgeom.h:297
double xmin
Definition: liblwgeom.h:295
double mmin
Definition: liblwgeom.h:301
uint8_t flags
Definition: liblwgeom.h:294

References GBOX::flags, FLAGS_GET_M, FLAGS_GET_Z, GBOX::mmax, GBOX::mmin, next_float_down(), next_float_up(), GBOX::xmax, GBOX::xmin, GBOX::ymax, GBOX::ymin, GBOX::zmax, and GBOX::zmin.

Referenced by gserialized_get_gbox_p(), gserialized_peek_gbox_p(), test_gserialized_peek_gbox_p_gets_correct_box(), and test_lwgeom_from_gserialized().

Here is the call graph for this function:
Here is the caller graph for this function: