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

Definition at line 363 of file cu_geodetic.c.

References clairaut_cartesian(), clairaut_geographic(), geog2cart(), GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, and point_set().

Referenced by geodetic_suite_setup().

364 {
365 
366  GEOGRAPHIC_POINT gs, ge;
367  POINT3D vs, ve;
368  GEOGRAPHIC_POINT g_out_top, g_out_bottom, v_out_top, v_out_bottom;
369 
370  point_set(-45.0, 60.0, &gs);
371  point_set(135.0, 60.0, &ge);
372 
373  geog2cart(&gs, &vs);
374  geog2cart(&ge, &ve);
375 
376  clairaut_cartesian(&vs, &ve, &v_out_top, &v_out_bottom);
377  clairaut_geographic(&gs, &ge, &g_out_top, &g_out_bottom);
378 
379  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lat, g_out_top.lat, 0.000001);
380  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lon, g_out_top.lon, 0.000001);
381  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lat, g_out_bottom.lat, 0.000001);
382  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lon, g_out_bottom.lon, 0.000001);
383 
384  gs.lat = 1.3021240033804449;
385  ge.lat = 1.3021240033804449;
386  gs.lon = -1.3387392931438733;
387  ge.lon = 1.80285336044592;
388 
389  geog2cart(&gs, &vs);
390  geog2cart(&ge, &ve);
391 
392  clairaut_cartesian(&vs, &ve, &v_out_top, &v_out_bottom);
393  clairaut_geographic(&gs, &ge, &g_out_top, &g_out_bottom);
394 
395  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lat, g_out_top.lat, 0.000001);
396  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lon, g_out_top.lon, 0.000001);
397  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lat, g_out_bottom.lat, 0.000001);
398  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lon, g_out_bottom.lon, 0.000001);
399 }
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:47
int clairaut_geographic(const GEOGRAPHIC_POINT *start, const GEOGRAPHIC_POINT *end, GEOGRAPHIC_POINT *g_top, GEOGRAPHIC_POINT *g_bottom)
Computes the pole of the great circle disk which is the intersection of the great circle with the lin...
Definition: lwgeodetic.c:1066
int clairaut_cartesian(const POINT3D *start, const POINT3D *end, GEOGRAPHIC_POINT *g_top, GEOGRAPHIC_POINT *g_bottom)
Computes the pole of the great circle disk which is the intersection of the great circle with the lin...
Definition: lwgeodetic.c:1041
static void point_set(double lon, double lat, GEOGRAPHIC_POINT *p)
Definition: cu_geodetic.c:356
void geog2cart(const GEOGRAPHIC_POINT *g, POINT3D *p)
Convert spherical coordinates to cartesion coordinates on unit sphere.
Definition: lwgeodetic.c:369

Here is the call graph for this function:

Here is the caller graph for this function: