PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_lwgeom_calculate_gbox ( void  )
static

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

192 {
193  LWGEOM *g;
194  GBOX b;
195 
196  g = lwgeom_from_wkt("POINT(0 0)", LW_PARSER_CHECK_NONE);
198  CU_ASSERT_DOUBLE_EQUAL(b.xmin, 0.0, 0.0000001);
199  lwgeom_free(g);
200 
201  /* Inf = 0x7FF0000000000000 */
202  /* POINT(0 0) = 00 00000001 0000000000000000 0000000000000000 */
203  /* POINT(0 Inf) = 00 00000001 0000000000000000 7FF0000000000000 */
204  g = lwgeom_from_hexwkb("000000000100000000000000007FF0000000000000", LW_PARSER_CHECK_NONE);
206  CU_ASSERT_DOUBLE_EQUAL(b.xmin, 0.0, 0.0000001);
207  CU_ASSERT(isinf(b.ymax));
208  lwgeom_free(g);
209 
210  /* LINESTRING(0 0, 0 Inf) = 00 00000002 00000002 0000000000000000 7FF0000000000000 0000000000000000 0000000000000000 */
211  /* Inf should show up in bbox */
212  g = lwgeom_from_hexwkb("00000000020000000200000000000000007FF000000000000000000000000000000000000000000000", LW_PARSER_CHECK_NONE);
214  CU_ASSERT_DOUBLE_EQUAL(b.xmin, 0.0, 0.0000001);
215  CU_ASSERT(isinf(b.ymax));
216  lwgeom_free(g);
217 
218  /* Geometry with NaN 0101000020E8640000000000000000F8FF000000000000F8FF */
219  /* NaN should show up in bbox */
220  g = lwgeom_from_hexwkb("0101000020E8640000000000000000F8FF000000000000F8FF", LW_PARSER_CHECK_NONE);
222  CU_ASSERT(isnan(b.ymax));
223  lwgeom_free(g);
224 
225 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:844
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:1706
double xmin
Definition: liblwgeom.h:248
double ymax
Definition: liblwgeom.h:251
LWGEOM * lwgeom_from_hexwkb(const char *hexwkb, const char check)
Definition: lwin_wkb.c:753
int lwgeom_calculate_gbox_cartesian(const LWGEOM *lwgeom, GBOX *gbox)
Calculate the 2-4D bounding box of a geometry.
Definition: g_box.c:607

Here is the call graph for this function:

Here is the caller graph for this function: