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

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

344 {
345 
346  GEOGRAPHIC_POINT gs, ge;
347  POINT3D vs, ve;
348  GEOGRAPHIC_POINT g_out_top, g_out_bottom, v_out_top, v_out_bottom;
349 
350  point_set(-45.0, 60.0, &gs);
351  point_set(135.0, 60.0, &ge);
352 
353  geog2cart(&gs, &vs);
354  geog2cart(&ge, &ve);
355 
356  clairaut_cartesian(&vs, &ve, &v_out_top, &v_out_bottom);
357  clairaut_geographic(&gs, &ge, &g_out_top, &g_out_bottom);
358 
359  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lat, g_out_top.lat, 0.000001);
360  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lon, g_out_top.lon, 0.000001);
361  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lat, g_out_bottom.lat, 0.000001);
362  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lon, g_out_bottom.lon, 0.000001);
363 
364  gs.lat = 1.3021240033804449;
365  ge.lat = 1.3021240033804449;
366  gs.lon = -1.3387392931438733;
367  ge.lon = 1.80285336044592;
368 
369  geog2cart(&gs, &vs);
370  geog2cart(&ge, &ve);
371 
372  clairaut_cartesian(&vs, &ve, &v_out_top, &v_out_bottom);
373  clairaut_geographic(&gs, &ge, &g_out_top, &g_out_bottom);
374 
375  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lat, g_out_top.lat, 0.000001);
376  CU_ASSERT_DOUBLE_EQUAL(v_out_top.lon, g_out_top.lon, 0.000001);
377  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lat, g_out_bottom.lat, 0.000001);
378  CU_ASSERT_DOUBLE_EQUAL(v_out_bottom.lon, g_out_bottom.lon, 0.000001);
379 }
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:33
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:1048
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:1023
static void point_set(double lon, double lat, GEOGRAPHIC_POINT *p)
Definition: cu_geodetic.c:336
void geog2cart(const GEOGRAPHIC_POINT *g, POINT3D *p)
Convert spherical coordinates to cartesion coordinates on unit sphere.
Definition: lwgeodetic.c:355

Here is the call graph for this function:

Here is the caller graph for this function: