PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ test_lwgeom_calculate_gbox()

static void test_lwgeom_calculate_gbox ( void  )
static

Definition at line 200 of file cu_libgeom.c.

References LW_PARSER_CHECK_NONE, lwgeom_calculate_gbox_cartesian(), lwgeom_free(), lwgeom_from_hexwkb(), lwgeom_from_wkt(), GBOX::xmin, and GBOX::ymax.

Referenced by libgeom_suite_setup().

201 {
202  LWGEOM *g;
203  GBOX b;
204 
205  g = lwgeom_from_wkt("POINT(0 0)", LW_PARSER_CHECK_NONE);
207  CU_ASSERT_DOUBLE_EQUAL(b.xmin, 0.0, 0.0000001);
208  lwgeom_free(g);
209 
210  /* Inf = 0x7FF0000000000000 */
211  /* POINT(0 0) = 00 00000001 0000000000000000 0000000000000000 */
212  /* POINT(0 Inf) = 00 00000001 0000000000000000 7FF0000000000000 */
213  g = lwgeom_from_hexwkb("000000000100000000000000007FF0000000000000", LW_PARSER_CHECK_NONE);
215  CU_ASSERT_DOUBLE_EQUAL(b.xmin, 0.0, 0.0000001);
216  CU_ASSERT(isinf(b.ymax));
217  lwgeom_free(g);
218 
219  /* LINESTRING(0 0, 0 Inf) = 00 00000002 00000002 0000000000000000 7FF0000000000000 0000000000000000 0000000000000000 */
220  /* Inf should show up in bbox */
221  g = lwgeom_from_hexwkb("00000000020000000200000000000000007FF000000000000000000000000000000000000000000000", LW_PARSER_CHECK_NONE);
223  CU_ASSERT_DOUBLE_EQUAL(b.xmin, 0.0, 0.0000001);
224  CU_ASSERT(isinf(b.ymax));
225  lwgeom_free(g);
226 
227  /* Geometry with NaN 0101000020E8640000000000000000F8FF000000000000F8FF */
228  /* NaN should show up in bbox for "SRID=4326;POINT(0 NaN)" */
229  g = lwgeom_from_hexwkb("0101000020E86400000000000000000000000000000000F8FF", LW_PARSER_CHECK_NONE);
231  CU_ASSERT(isnan(b.ymax));
232  lwgeom_free(g);
233 
234 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:890
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1869
double xmin
Definition: liblwgeom.h:276
double ymax
Definition: liblwgeom.h:279
LWGEOM * lwgeom_from_hexwkb(const char *hexwkb, const char check)
Definition: lwin_wkb.c:779
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
Definition: g_box.c:648
Here is the call graph for this function:
Here is the caller graph for this function: