180 double d1, d2, d3, d4, e1, e2;
181 double threshold = 0.0;
187 lwg1 =
lwgeom_from_wkt(
"POLYGON((58.5112113206308 0,58.5112113200772 0.000901937525203378,58.511300910044 0.000901937636668872,58.5113009105976 0,58.5112113206308 0))",
LW_PARSER_CHECK_NONE);
189 lwg2 =
lwgeom_from_wkt(
"POLYGON((58.5111665256017 0.000270581240841207,58.5111665255629 0.000360774987788249,58.5110769356128 0.000360774943200728,58.5110769356515 0.000270581207400566,58.5111665256017 0.000270581240841207))",
LW_PARSER_CHECK_NONE);
206 CU_ASSERT_DOUBLE_EQUAL(e1, e2, 0.0001);
225 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.0000001);
238 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.00001);
250 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.00001);
262 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.00001);
274 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.00001);
290 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.00001);
309 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.0000001);
313 lwg2 =
lwgeom_from_wkt(
"POLYGON((-9.1111111 40,-9.14954053919354 39.6098193559677,-9.26335203497743 39.2346331352698,-9.44817187539491 38.8888595339608,-9.6968975376269 38.5857864376269,-9.99997063396079 38.3370607753949,-10.3457442352698 38.1522409349774,-10.7209304559677 38.0384294391935,-11.1111111 38,-11.5012917440323 38.0384294391935,-11.8764779647302 38.1522409349774,-12.2222515660392 38.3370607753949,-12.5253246623731 38.5857864376269,-12.7740503246051 38.8888595339608,-12.9588701650226 39.2346331352698,-13.0726816608065 39.6098193559677,-13.1111111 40,-13.0726816608065 40.3901806440322,-12.9588701650226 40.7653668647302,-12.7740503246051 41.1111404660392,-12.5253246623731 41.4142135623731,-12.2222515660392 41.6629392246051,-11.8764779647302 41.8477590650226,-11.5012917440323 41.9615705608065,-11.1111111 42,-10.7209304559678 41.9615705608065,-10.3457442352698 41.8477590650226,-9.9999706339608 41.6629392246051,-9.69689753762691 41.4142135623731,-9.44817187539491 41.1111404660392,-9.26335203497743 40.7653668647302,-9.14954053919354 40.3901806440323,-9.1111111 40))",
LW_PARSER_CHECK_NONE);
327 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.0000001);
330 lwg1 =
lwgeom_from_wkt(
"MULTIPOINT Z (-10 40 1,-10 65 1,10 40 1,10 65 1,30 40 1,30 65 1,50 40 1,50 65 1,-10 40 2,-10 65 2,10 40 2,10 65 2,30 40 2,30 65 2,50 40 2,50 65 2,-10 40 3,-10 65 3,10 40 3,10 65 3,30 40 3,30 65 3,50 40 3,50 65 3)",
LW_PARSER_CHECK_NONE);
331 lwg2 =
lwgeom_from_wkt(
"MULTIPOLYGON(((-9.1111111 40,-9.14954053919354 39.6098193559677,-9.26335203497743 39.2346331352698,-9.44817187539491 38.8888595339608,-9.6968975376269 38.5857864376269,-9.99997063396079 38.3370607753949,-10.3457442352698 38.1522409349774,-10.7209304559677 38.0384294391935,-11.1111111 38,-11.5012917440323 38.0384294391935,-11.8764779647302 38.1522409349774,-12.2222515660392 38.3370607753949,-12.5253246623731 38.5857864376269,-12.7740503246051 38.8888595339608,-12.9588701650226 39.2346331352698,-13.0726816608065 39.6098193559677,-13.1111111 40,-13.0726816608065 40.3901806440322,-12.9588701650226 40.7653668647302,-12.7740503246051 41.1111404660392,-12.5253246623731 41.4142135623731,-12.2222515660392 41.6629392246051,-11.8764779647302 41.8477590650226,-11.5012917440323 41.9615705608065,-11.1111111 42,-10.7209304559678 41.9615705608065,-10.3457442352698 41.8477590650226,-9.9999706339608 41.6629392246051,-9.69689753762691 41.4142135623731,-9.44817187539491 41.1111404660392,-9.26335203497743 40.7653668647302,-9.14954053919354 40.3901806440323,-9.1111111 40)))",
LW_PARSER_CHECK_NONE);
348 CU_ASSERT_DOUBLE_EQUAL(d1, d2, 0.00000001);
349 CU_ASSERT_DOUBLE_EQUAL(d1, d3, 0.00000001);
350 CU_ASSERT_DOUBLE_EQUAL(d1, d4, 0.00000001);
double lwgeom_distance_spheroid(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, const SPHEROID *spheroid, double tolerance)
Calculate the geodetic distance from lwgeom1 to lwgeom2 on the spheroid.
void lwgeom_free(LWGEOM *geom)
#define LW_PARSER_CHECK_NONE
void spheroid_init(SPHEROID *s, double a, double b)
Initialize a spheroid object for use in geodetic functions.
LWGEOM * lwgeom_from_wkt(const char *wkt, const char check)
double circ_tree_distance_tree(const CIRC_NODE *n1, const CIRC_NODE *n2, const SPHEROID *spheroid, double threshold)
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.