PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ test_rect_tree_intersects_tree()

static void test_rect_tree_intersects_tree ( void  )
static

Definition at line 364 of file cu_measures.c.

References LW_FALSE, LW_TRUE, and tree_inter().

Referenced by measures_suite_setup().

365 {
366  /* total overlap, A == B */
367  CU_ASSERT_EQUAL(tree_inter(
368  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
369  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))"),
370  LW_TRUE
371  );
372 
373  /* hiding between the tines of the comb */
374  CU_ASSERT_EQUAL(tree_inter(
375  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
376  "POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 0.4 0.7, 0.3 0.7))"),
377  LW_FALSE
378  );
379 
380  /* between the tines, but with a corner overlapping */
381  CU_ASSERT_EQUAL(tree_inter(
382  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
383  "POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 1.3 0.3, 0.3 0.7))"),
384  LW_TRUE
385  );
386 
387  /* Just touching the top left corner of the comb */
388  CU_ASSERT_EQUAL(tree_inter(
389  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
390  "POLYGON((-1 5, 0 5, 0 7, -1 7, -1 5))"),
391  LW_TRUE
392  );
393 
394  /* Contained, complex */
395  CU_ASSERT_EQUAL(tree_inter(
396  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
397  "GEOMETRYCOLLECTION(MULTILINESTRING((1 2, 3 2)),POINT(1 2))"),
398  LW_TRUE
399  );
400 
401  /* Touching, complex */
402  CU_ASSERT_EQUAL(tree_inter(
403  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
404  "GEOMETRYCOLLECTION(MULTILINESTRING((6 3, 8 4)),POINT(5 3))"),
405  LW_TRUE
406  );
407 
408  /* Not Touching, complex */
409  CU_ASSERT_EQUAL(tree_inter(
410  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
411  "GEOMETRYCOLLECTION(MULTILINESTRING((6 3, 8 4)),POINT(1 3.5))"),
412  LW_FALSE
413  );
414 
415  /* Crossing, complex */
416  CU_ASSERT_EQUAL(tree_inter(
417  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
418  "GEOMETRYCOLLECTION(MULTILINESTRING((1.5 4.1, 1.6 2)),POINT(1 3.5))"),
419  LW_TRUE
420  );
421 }
static int tree_inter(const char *wkt1, const char *wkt2)
Definition: cu_measures.c:350
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
Here is the call graph for this function:
Here is the caller graph for this function: