PostGIS  2.2.8dev-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 54 of file lwgeodetic.c.

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

55 {
56 
57  if ( lat > 2.0 * M_PI )
58  lat = remainder(lat, 2.0 * M_PI);
59 
60  if ( lat < -2.0 * M_PI )
61  lat = remainder(lat, -2.0 * M_PI);
62 
63  if ( lat > M_PI )
64  lat = M_PI - lat;
65 
66  if ( lat < -1.0 * M_PI )
67  lat = -1.0 * M_PI - lat;
68 
69  if ( lat > M_PI_2 )
70  lat = M_PI - lat;
71 
72  if ( lat < -1.0 * M_PI_2 )
73  lat = -1.0 * M_PI - lat;
74 
75  return lat;
76 }
Here is the caller graph for this function: