PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_lwpoly_covers_point2d()

static void test_lwpoly_covers_point2d ( void  )
static

Definition at line 1122 of file cu_geodetic.c.

References LW_PARSER_CHECK_NONE, LW_TRUE, lwgeom_free(), lwgeom_from_wkt(), lwpoly_covers_point2d(), POINT2D::x, and POINT2D::y.

Referenced by geodetic_suite_setup().

1123 {
1124  LWPOLY *poly;
1125  LWGEOM *lwg;
1126  POINT2D pt_to_test;
1127  int result;
1128 
1129  lwg = lwgeom_from_wkt("POLYGON((-9 50,51 -11,-10 50,-9 50))", LW_PARSER_CHECK_NONE);
1130  poly = (LWPOLY*)lwg;
1131  pt_to_test.x = -10.0;
1132  pt_to_test.y = 50.0;
1133  result = lwpoly_covers_point2d(poly, &pt_to_test);
1134  CU_ASSERT_EQUAL(result, LW_TRUE);
1135  lwgeom_free(lwg);
1136 
1137  /* Great big ring */
1138  lwg = lwgeom_from_wkt("POLYGON((-40.0 52.0, -67.0 -29.0, 102.0 -6.0, -40.0 52.0))", LW_PARSER_CHECK_NONE);
1139  poly = (LWPOLY*)lwg;
1140  pt_to_test.x = 4.0;
1141  pt_to_test.y = 11.0;
1142  result = lwpoly_covers_point2d(poly, &pt_to_test);
1143  CU_ASSERT_EQUAL(result, LW_TRUE);
1144  lwgeom_free(lwg);
1145 
1146  /* Triangle over the antimeridian */
1147  lwg = lwgeom_from_wkt("POLYGON((140 52, 152.0 -6.0, -120.0 -29.0, 140 52))", LW_PARSER_CHECK_NONE);
1148  poly = (LWPOLY*)lwg;
1149  pt_to_test.x = -172.0;
1150  pt_to_test.y = -13.0;
1151  result = lwpoly_covers_point2d(poly, &pt_to_test);
1152  CU_ASSERT_EQUAL(result, LW_TRUE);
1153  lwgeom_free(lwg);
1154 
1155 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2013
double x
Definition: liblwgeom.h:328
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
double y
Definition: liblwgeom.h:328
int lwpoly_covers_point2d(const LWPOLY *poly, const POINT2D *pt_to_test)
Given a polygon (lon/lat decimal degrees) and point (lon/lat decimal degrees) and a guaranteed outsid...
Definition: lwgeodetic.c:2510
Here is the call graph for this function:
Here is the caller graph for this function: