PostGIS  2.5.0dev-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 69 of file lwgeodetic.c.

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

70 {
71 
72  if ( lat > 2.0 * M_PI )
73  lat = remainder(lat, 2.0 * M_PI);
74 
75  if ( lat < -2.0 * M_PI )
76  lat = remainder(lat, -2.0 * M_PI);
77 
78  if ( lat > M_PI )
79  lat = M_PI - lat;
80 
81  if ( lat < -1.0 * M_PI )
82  lat = -1.0 * M_PI - lat;
83 
84  if ( lat > M_PI_2 )
85  lat = M_PI - lat;
86 
87  if ( lat < -1.0 * M_PI_2 )
88  lat = -1.0 * M_PI - lat;
89 
90  return lat;
91 }
Here is the caller graph for this function: