PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ latitude_radians_normalize()

double latitude_radians_normalize ( double  lat)

Convert a latitude to the range of -PI/2,PI/2.

Definition at line 78 of file lwgeodetic.c.

79 {
80 
81  if ( lat > 2.0 * M_PI )
82  lat = remainder(lat, 2.0 * M_PI);
83 
84  if ( lat < -2.0 * M_PI )
85  lat = remainder(lat, -2.0 * M_PI);
86 
87  if ( lat > M_PI )
88  lat = M_PI - lat;
89 
90  if ( lat < -1.0 * M_PI )
91  lat = -1.0 * M_PI - lat;
92 
93  if ( lat > M_PI_2 )
94  lat = M_PI - lat;
95 
96  if ( lat < -1.0 * M_PI_2 )
97  lat = -1.0 * M_PI - lat;
98 
99  return lat;
100 }

Referenced by geographic_point_init(), lwgeom_project_spheroid(), and point_deg2rad().

Here is the caller graph for this function: