PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ test_rect_tree_intersects_tree()

static void test_rect_tree_intersects_tree ( void  )
static

Definition at line 409 of file cu_measures.c.

References LW_FALSE, LW_TRUE, and tree_inter().

Referenced by measures_suite_setup().

410 {
411  /* total overlap, A == B */
412  CU_ASSERT_EQUAL(tree_inter(
413  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
414  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))"),
415  LW_TRUE
416  );
417 
418  /* hiding between the tines of the comb */
419  CU_ASSERT_EQUAL(tree_inter(
420  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
421  "POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 0.4 0.7, 0.3 0.7))"),
422  LW_FALSE
423  );
424 
425  /* between the tines, but with a corner overlapping */
426  CU_ASSERT_EQUAL(tree_inter(
427  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
428  "POLYGON((0.3 0.7, 0.3 0.8, 0.4 0.8, 1.3 0.3, 0.3 0.7))"),
429  LW_TRUE
430  );
431 
432  /* Just touching the top left corner of the comb */
433  CU_ASSERT_EQUAL(tree_inter(
434  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
435  "POLYGON((-1 5, 0 5, 0 7, -1 7, -1 5))"),
436  LW_TRUE
437  );
438 
439  /* Contained, complex */
440  CU_ASSERT_EQUAL(tree_inter(
441  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
442  "GEOMETRYCOLLECTION(MULTILINESTRING((1 2, 3 2)),POINT(1 2))"),
443  LW_TRUE
444  );
445 
446  /* Touching, complex */
447  CU_ASSERT_EQUAL(tree_inter(
448  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
449  "GEOMETRYCOLLECTION(MULTILINESTRING((6 3, 8 4)),POINT(5 3))"),
450  LW_TRUE
451  );
452 
453  /* Not Touching, complex */
454  CU_ASSERT_EQUAL(tree_inter(
455  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
456  "GEOMETRYCOLLECTION(MULTILINESTRING((6 3, 8 4)),POINT(1 3.5))"),
457  LW_FALSE
458  );
459 
460  /* Crossing, complex */
461  CU_ASSERT_EQUAL(tree_inter(
462  "POLYGON((0 0, 3 1, 0 2, 3 3, 0 4, 3 5, 0 6, 5 6, 5 0, 0 0))",
463  "GEOMETRYCOLLECTION(MULTILINESTRING((1.5 4.1, 1.6 2)),POINT(1 3.5))"),
464  LW_TRUE
465  );
466 }
static int tree_inter(const char *wkt1, const char *wkt2)
Definition: cu_measures.c:395
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
Here is the call graph for this function:
Here is the caller graph for this function: