PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_edge_distance_to_edge()

static void test_edge_distance_to_edge ( void  )
static

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

768 {
769  GEOGRAPHIC_EDGE e1, e2;
770  GEOGRAPHIC_POINT c1, c2;
771  double d;
772 
773  /* closest point at origin, one degree away */
774  edge_set(-50.0, 0.0, 50.0, 0.0, &e1);
775  edge_set(-5.0, 20.0, 0.0, 1.0, &e2);
776  d = edge_distance_to_edge(&e1, &e2, &c1, &c2);
777 #if 0
778  printf("LINESTRING(%.8g %.8g, %.8g %.8g)\n", e1.start.lon, e1.start.lat, e1.end.lon, e1.end.lat);
779  printf("LINESTRING(%.8g %.8g, %.8g %.8g)\n", e2.start.lon, e2.start.lat, e2.end.lon, e2.end.lat);
780  printf("\nDISTANCE == %.8g\n", d);
781 #endif
782  CU_ASSERT_DOUBLE_EQUAL(d, M_PI / 180.0, 0.00001);
783  CU_ASSERT_DOUBLE_EQUAL(c1.lat, 0.0, 0.00001);
784  CU_ASSERT_DOUBLE_EQUAL(c2.lat, M_PI / 180.0, 0.00001);
785  CU_ASSERT_DOUBLE_EQUAL(c1.lon, 0.0, 0.00001);
786  CU_ASSERT_DOUBLE_EQUAL(c2.lon, 0.0, 0.00001);
787 }
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:1265
Two-point great circle segment from a to b.
Definition: lwgeodetic.h:61
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:52
GEOGRAPHIC_POINT start
Definition: lwgeodetic.h:63
GEOGRAPHIC_POINT end
Definition: lwgeodetic.h:64
Here is the call graph for this function:
Here is the caller graph for this function: