PostGIS  2.1.10dev-r@@SVN_REVISION@@
 double lwgeom_azumith_spheroid ( const LWPOINT * r, const LWPOINT * s, const SPHEROID * spheroid )

Calculate the bearing between two points on a spheroid.

Calculate the bearing between two points on a spheroid.

Parameters
 r - location of first point. s - location of second point. spheroid - spheroid definition.
Returns
azimuth - azimuth in radians.

Definition at line 2047 of file lwgeodetic.c.

Referenced by geography_azimuth().

2048 {
2049  GEOGRAPHIC_POINT g1, g2;
2050  double x1, y1, x2, y2;
2051
2052  /* Convert r to a geodetic point */
2053  x1 = lwpoint_get_x(r);
2054  y1 = lwpoint_get_y(r);
2055  geographic_point_init(x1, y1, &g1);
2056
2057  /* Convert s to a geodetic point */
2058  x2 = lwpoint_get_x(s);
2059  y2 = lwpoint_get_y(s);
2060  geographic_point_init(x2, y2, &g2);
2061
2062  /* Same point, return NaN */
2063  if ( FP_EQUALS(x1, x2) && FP_EQUALS(y1, y2) )
2064  {
2065  return NAN;
2066  }
2067
2068  /* Do the direction calculation */
2069  return spheroid_direction(&g1, &g2, spheroid);
2070 }
double spheroid_direction(const GEOGRAPHIC_POINT *r, const GEOGRAPHIC_POINT *s, const SPHEROID *spheroid)
Computes the direction of the geodesic joining two points on the spheroid.
Definition: lwspheroid.c:155
#define NAN
Definition: lwgeodetic.h:23
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:33
double lwpoint_get_x(const LWPOINT *point)
Definition: lwpoint.c:48
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
Definition: lwgeodetic.c:157
#define FP_EQUALS(A, B)
double lwpoint_get_y(const LWPOINT *point)
Definition: lwpoint.c:58

Here is the call graph for this function: Here is the caller graph for this function: 