Definition at line 255 of file cu_measures.c.
263 poly =
lwgeom_from_wkt(
"CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(0 0,1 5,0 10),(0 10,10 10,10 0, 0 0)),COMPOUNDCURVE(CIRCULARSTRING(3 7,5 8,7 7),(7 7,7 3,3 3, 3 7)))",
LW_PARSER_CHECK_NONE);
271 CU_ASSERT_EQUAL(
tree_pt(tree, 5, 7.5), 0);
273 CU_ASSERT_EQUAL(
tree_pt(tree, 8, 9), 1);
275 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 5), 0);
277 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 7.5), 0);
279 CU_ASSERT_EQUAL(
tree_pt(tree, 0.2, 7.5), 0);
281 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 0.5), 1);
283 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 7.5), 1);
285 CU_ASSERT_EQUAL(
tree_pt(tree, 7, 7), 1);
294 poly =
lwgeom_from_wkt(
"POLYGON((0 0,0 10,10 10,10 0,9 0,9 9,8 6,8 0,2 0,2 9,1 6,1 0,0 0),(4 4,4 6,6 6,6 4,4 4))",
LW_PARSER_CHECK_NONE);
298 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 6), 1);
300 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 5.5), 1);
302 CU_ASSERT_EQUAL(
tree_pt(tree, -3, 5.5), 0);
304 CU_ASSERT_EQUAL(
tree_pt(tree, 4, 4), 1);
305 CU_ASSERT_EQUAL(
tree_pt(tree, 6, 6), 1);
307 CU_ASSERT_EQUAL(
tree_pt(tree, 4.5, 4), 1);
309 CU_ASSERT_EQUAL(
tree_pt(tree, 8, 0), 1);
310 CU_ASSERT_EQUAL(
tree_pt(tree, 9, 0), 1);
311 CU_ASSERT_EQUAL(
tree_pt(tree, 10, 1), 1);
312 CU_ASSERT_EQUAL(
tree_pt(tree, 9.5, 1), 1);
313 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 10), 1);
315 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 6), 1);
317 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 6), 0);
319 CU_ASSERT_EQUAL(
tree_pt(tree, 5, 5), 0);
321 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 4), 1);
322 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 6), 1);
323 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 9), 1);
335 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 0.5), 1);
337 CU_ASSERT_EQUAL(
tree_pt(tree, 1.5, 0.5), 0);
339 CU_ASSERT_EQUAL(
tree_pt(tree, -1, 1), 0);
341 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 1), 1);
343 CU_ASSERT_EQUAL(
tree_pt(tree, 0.5, 1), 1);
345 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 0.5), 1);
355 CU_ASSERT_EQUAL(
tree_pt(tree, -0.5, 0.5), 0);
357 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 1), 0);
359 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 1), 1);
361 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 1), 1);
363 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 3), 1);
365 CU_ASSERT_EQUAL(
tree_pt(tree, 4, 0), 1);
367 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 3), 1);
369 CU_ASSERT_EQUAL(
tree_pt(tree, 2, 0), 1);
377 poly =
lwgeom_from_wkt(
"POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
LW_PARSER_CHECK_NONE);
381 CU_ASSERT_EQUAL(
tree_pt(tree, -0.5, 3.5), 0);
383 CU_ASSERT_EQUAL(
tree_pt(tree, 6.0, 2.2), 0);
385 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 2), 1);
387 CU_ASSERT_EQUAL(
tree_pt(tree, 1, 0), 1);
389 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 6), 1);
391 CU_ASSERT_EQUAL(
tree_pt(tree, 3, 1), 1);
393 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 2), 1);
395 CU_ASSERT_EQUAL(
tree_pt(tree, 0, 6), 1);
static int tree_pt(RECT_NODE *tree, double x, double y)
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
RECT_NODE * rect_tree_from_lwgeom(const LWGEOM *lwgeom)
Create a tree index on top an LWGEOM.
void rect_tree_free(RECT_NODE *node)
Recurse from top of node tree and free all children.
References LW_PARSER_CHECK_NONE, lwgeom_free(), lwgeom_from_wkt(), rect_tree_free(), rect_tree_from_lwgeom(), and tree_pt().
Referenced by measures_suite_setup().