PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ test_lwpoly_covers_point2d()

static void test_lwpoly_covers_point2d ( void  )
static

Definition at line 1122 of file cu_geodetic.c.

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}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
#define LW_PARSER_CHECK_NONE
Definition liblwgeom.h:2149
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:93
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
Definition lwin_wkt.c:940
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...
double y
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:390

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

Referenced by geodetic_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: