PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void test_edge_distance_to_edge ( void  )
static

Definition at line 741 of file cu_geodetic.c.

References edge_distance_to_edge(), edge_set(), GEOGRAPHIC_EDGE::end, GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, and GEOGRAPHIC_EDGE::start.

Referenced by geodetic_suite_setup().

742 {
743  GEOGRAPHIC_EDGE e1, e2;
744  GEOGRAPHIC_POINT c1, c2;
745  double d;
746 
747  /* closest point at origin, one degree away */
748  edge_set(-50.0, 0.0, 50.0, 0.0, &e1);
749  edge_set(-5.0, 20.0, 0.0, 1.0, &e2);
750  d = edge_distance_to_edge(&e1, &e2, &c1, &c2);
751 #if 0
752  printf("LINESTRING(%.8g %.8g, %.8g %.8g)\n", e1.start.lon, e1.start.lat, e1.end.lon, e1.end.lat);
753  printf("LINESTRING(%.8g %.8g, %.8g %.8g)\n", e2.start.lon, e2.start.lat, e2.end.lon, e2.end.lat);
754  printf("\nDISTANCE == %.8g\n", d);
755 #endif
756  CU_ASSERT_DOUBLE_EQUAL(d, M_PI / 180.0, 0.00001);
757  CU_ASSERT_DOUBLE_EQUAL(c1.lat, 0.0, 0.00001);
758  CU_ASSERT_DOUBLE_EQUAL(c2.lat, M_PI / 180.0, 0.00001);
759  CU_ASSERT_DOUBLE_EQUAL(c1.lon, 0.0, 0.00001);
760  CU_ASSERT_DOUBLE_EQUAL(c2.lon, 0.0, 0.00001);
761 }
double edge_distance_to_edge(const GEOGRAPHIC_EDGE *e1, const GEOGRAPHIC_EDGE *e2, GEOGRAPHIC_POINT *closest1, GEOGRAPHIC_POINT *closest2)
Calculate the distance between two edges.
Definition: lwgeodetic.c:1216
Two-point great circle segment from a to b.
Definition: lwgeodetic.h:42
static void edge_set(double lon1, double lat1, double lon2, double lat2, GEOGRAPHIC_EDGE *e)
Definition: cu_geodetic.c:327
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:33
GEOGRAPHIC_POINT start
Definition: lwgeodetic.h:44
GEOGRAPHIC_POINT end
Definition: lwgeodetic.h:45

Here is the call graph for this function:

Here is the caller graph for this function: