PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ z_to_latitude()

double z_to_latitude ( double  z,
int  top 
)

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

Definition at line 1045 of file lwgeodetic.c.

References FP_IS_ZERO, LWDEBUGF, and SIGNUM.

Referenced by clairaut_cartesian(), and clairaut_geographic().

1046 {
1047  double sign = SIGNUM(z);
1048  double tlat = acos(z);
1049  LWDEBUGF(4, "inputs: z(%.8g) sign(%.8g) tlat(%.8g)", z, sign, tlat);
1050  if (FP_IS_ZERO(z))
1051  {
1052  if (top) return M_PI_2;
1053  else return -1.0 * M_PI_2;
1054  }
1055  if (fabs(tlat) > M_PI_2 )
1056  {
1057  tlat = sign * (M_PI - fabs(tlat));
1058  }
1059  else
1060  {
1061  tlat = sign * tlat;
1062  }
1063  LWDEBUGF(4, "output: tlat(%.8g)", tlat);
1064  return tlat;
1065 }
#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: