PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ test_edge_distance_to_edge()

static void test_edge_distance_to_edge ( void  )
static

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

762 {
763  GEOGRAPHIC_EDGE e1, e2;
764  GEOGRAPHIC_POINT c1, c2;
765  double d;
766 
767  /* closest point at origin, one degree away */
768  edge_set(-50.0, 0.0, 50.0, 0.0, &e1);
769  edge_set(-5.0, 20.0, 0.0, 1.0, &e2);
770  d = edge_distance_to_edge(&e1, &e2, &c1, &c2);
771 #if 0
772  printf("LINESTRING(%.8g %.8g, %.8g %.8g)\n", e1.start.lon, e1.start.lat, e1.end.lon, e1.end.lat);
773  printf("LINESTRING(%.8g %.8g, %.8g %.8g)\n", e2.start.lon, e2.start.lat, e2.end.lon, e2.end.lat);
774  printf("\nDISTANCE == %.8g\n", d);
775 #endif
776  CU_ASSERT_DOUBLE_EQUAL(d, M_PI / 180.0, 0.00001);
777  CU_ASSERT_DOUBLE_EQUAL(c1.lat, 0.0, 0.00001);
778  CU_ASSERT_DOUBLE_EQUAL(c2.lat, M_PI / 180.0, 0.00001);
779  CU_ASSERT_DOUBLE_EQUAL(c1.lon, 0.0, 0.00001);
780  CU_ASSERT_DOUBLE_EQUAL(c2.lon, 0.0, 0.00001);
781 }
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:1238
Two-point great circle segment from a to b.
Definition: lwgeodetic.h:56
static void edge_set(double lon1, double lat1, double lon2, double lat2, GEOGRAPHIC_EDGE *e)
Definition: cu_geodetic.c:347
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:47
GEOGRAPHIC_POINT start
Definition: lwgeodetic.h:58
GEOGRAPHIC_POINT end
Definition: lwgeodetic.h:59
Here is the call graph for this function:
Here is the caller graph for this function: