PostGIS  2.5.0dev-r@@SVN_REVISION@@
static void test_sphere_direction ( void  )
static

Definition at line 69 of file cu_geodetic.c.

References geographic_point_init(), s, sphere_direction(), and sphere_distance().

Referenced by geodetic_suite_setup().

70 {
72  double dir, dist;
73 
74  geographic_point_init(0, 0, &s);
75  geographic_point_init(1, 0, &e);
76  dist = sphere_distance(&s, &e);
77  dir = sphere_direction(&s, &e, dist);
78  /* GeodSolve -i -E -p 16 -e 1 0 --input-string "0 0 0 1" */
79  CU_ASSERT_DOUBLE_EQUAL(dir, M_PI_2, 1e-14);
80  CU_ASSERT_DOUBLE_EQUAL(dist, 0.0174532925199433, 1e-14);
81 
82  geographic_point_init(0, 0, &s);
83  geographic_point_init(0, 1, &e);
84  dist = sphere_distance(&s, &e);
85  dir = sphere_direction(&s, &e, dist);
86  /* GeodSolve -i -E -p 16 -e 1 0 --input-string "0 0 1 0" */
87  CU_ASSERT_DOUBLE_EQUAL(dir, 0.0, 1e-14);
88  CU_ASSERT_DOUBLE_EQUAL(dist, 0.0174532925199433, 1e-14);
89 
90 }
double sphere_distance(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
Given two points on a unit sphere, calculate their distance apart in radians.
Definition: lwgeodetic.c:913
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:47
char * s
Definition: cu_in_wkt.c:23
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
Definition: lwgeodetic.c:171
double sphere_direction(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e, double d)
Given two points on a unit sphere, calculate the direction from s to e.
Definition: lwgeodetic.c:940

Here is the call graph for this function:

Here is the caller graph for this function: