PostGIS  2.5.0dev-r@@SVN_REVISION@@
double z_to_latitude ( double  z,
int  top 
)

Used in great circle to compute the pole of the great circle.

Definition at line 1014 of file lwgeodetic.c.

References FP_IS_ZERO, LWDEBUGF, and SIGNUM.

Referenced by clairaut_cartesian(), and clairaut_geographic().

1015 {
1016  double sign = SIGNUM(z);
1017  double tlat = acos(z);
1018  LWDEBUGF(4, "inputs: z(%.8g) sign(%.8g) tlat(%.8g)", z, sign, tlat);
1019  if (FP_IS_ZERO(z))
1020  {
1021  if (top) return M_PI_2;
1022  else return -1.0 * M_PI_2;
1023  }
1024  if (fabs(tlat) > M_PI_2 )
1025  {
1026  tlat = sign * (M_PI - fabs(tlat));
1027  }
1028  else
1029  {
1030  tlat = sign * tlat;
1031  }
1032  LWDEBUGF(4, "output: tlat(%.8g)", tlat);
1033  return tlat;
1034 }
#define FP_IS_ZERO(A)
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
#define SIGNUM(n)
Macro that returns: -1 if n < 0, 1 if n > 0, 0 if n == 0.

Here is the caller graph for this function: