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

Definition at line 71 of file cu_geodetic.c.

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

Referenced by geodetic_suite_setup().

72 {
74  double dir, dist;
75 
76  geographic_point_init(0, 0, &s);
77  geographic_point_init(1, 0, &e);
78  dist = sphere_distance(&s, &e);
79  dir = sphere_direction(&s, &e, dist);
80  CU_ASSERT_DOUBLE_EQUAL(dir, M_PI / 2.0, 0.0001);
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  CU_ASSERT_DOUBLE_EQUAL(dir, 0.0, 0.0001);
87 
88 }
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:897
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:33
char * s
Definition: cu_in_wkt.c:24
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
Definition: lwgeodetic.c:157
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:924

Here is the call graph for this function:

Here is the caller graph for this function: