PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ test_lwpoly_covers_point2d()

static void test_lwpoly_covers_point2d ( void  )
static

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

1117 {
1118  LWPOLY *poly;
1119  LWGEOM *lwg;
1120  POINT2D pt_to_test;
1121  int result;
1122 
1123  lwg = lwgeom_from_wkt("POLYGON((-9 50,51 -11,-10 50,-9 50))", LW_PARSER_CHECK_NONE);
1124  poly = (LWPOLY*)lwg;
1125  pt_to_test.x = -10.0;
1126  pt_to_test.y = 50.0;
1127  result = lwpoly_covers_point2d(poly, &pt_to_test);
1128  CU_ASSERT_EQUAL(result, LW_TRUE);
1129  lwgeom_free(lwg);
1130 
1131  /* Great big ring */
1132  lwg = lwgeom_from_wkt("POLYGON((-40.0 52.0, 102.0 -6.0, -67.0 -29.0, -40.0 52.0))", LW_PARSER_CHECK_NONE);
1133  poly = (LWPOLY*)lwg;
1134  pt_to_test.x = 4.0;
1135  pt_to_test.y = 11.0;
1136  result = lwpoly_covers_point2d(poly, &pt_to_test);
1137  CU_ASSERT_EQUAL(result, LW_TRUE);
1138  lwgeom_free(lwg);
1139 
1140  /* Triangle over the antimeridian */
1141  lwg = lwgeom_from_wkt("POLYGON((140 52, 152.0 -6.0, -120.0 -29.0, 140 52))", LW_PARSER_CHECK_NONE);
1142  poly = (LWPOLY*)lwg;
1143  pt_to_test.x = -172.0;
1144  pt_to_test.y = -13.0;
1145  result = lwpoly_covers_point2d(poly, &pt_to_test);
1146  CU_ASSERT_EQUAL(result, LW_TRUE);
1147  lwgeom_free(lwg);
1148 
1149 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition: lwin_wkt.c:904
#define LW_PARSER_CHECK_NONE
Definition: liblwgeom.h:2004
double x
Definition: liblwgeom.h:330
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
double y
Definition: liblwgeom.h:330
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:2431
Here is the call graph for this function:
Here is the caller graph for this function: