110 #define PI 3.14159265358979323e0
111 #define PI_OVER_2 (PI / 2.0)
112 #define TWO_PI (2.0 * PI)
113 #define POLAR_POW(EsSin) pow((1.0 - EsSin) / (1.0 + EsSin), es_OVER_2)
125 static double es = 0.08181919084262188000;
128 static double tc = 1.0;
129 static double e4 = 1.0033565552493;
156 double Latitude_of_True_Scale,
157 double longitude_Down_from_Pole,
158 double False_Easting,
159 double False_Northing)
179 double one_PLUS_es, one_MINUS_es;
181 double temp, temp_northing;
182 double inv_f = 1 /
f;
191 if ((inv_f < 250) || (inv_f > 350))
199 if ((longitude_Down_from_Pole < -
PI) || (longitude_Down_from_Pole >
TWO_PI))
211 if (longitude_Down_from_Pole >
PI)
212 longitude_Down_from_Pole -=
TWO_PI;
213 if (Latitude_of_True_Scale < 0)
238 mc = clat / sqrt(1.0 - essin * essin);
244 one_PLUS_es = 1.0 +
es;
245 one_MINUS_es = 1.0 -
es;
246 e4 = sqrt(pow(one_PLUS_es, one_PLUS_es) * pow(one_MINUS_es, one_MINUS_es));
251 &temp, &temp_northing);
277 double *Latitude_of_True_Scale,
278 double *longitude_Down_from_Pole,
279 double *False_Easting,
280 double *False_Northing)
345 if ((longitude < -
PI) || (longitude >
TWO_PI))
354 if (fabs(fabs(Latitude) -
PI_OVER_2) < 1.0e-10)
375 slat = sin(Latitude);
378 t = tan(
PI_Over_4 - Latitude / 2.0) / pow_es;
425 double dy = 0, dx = 0;
429 double tempPHI = 0.0;
439 if (Easting > max_easting || Easting < min_easting)
443 if (Northing > max_northing || Northing < min_northing)
454 rho = sqrt(dx * dx + dy * dy);
456 delta_radius = sqrt(Polar_Delta_Easting * Polar_Delta_Easting + Polar_Delta_Northing * Polar_Delta_Northing);
458 if(rho > delta_radius)
465 if ((dy == 0.0) && (dx == 0.0))
484 while (fabs(PHI - tempPHI) > 1.0e-10)
488 essin =
es * sin_PHI;
490 PHI =
PI_OVER_2 - 2.0 * atan(t * pow_es);
497 else if (*longitude < -
PI)
508 else if (*longitude < -
PI)
int Convert_Geodetic_To_Polar_Stereographic(double Latitude, double longitude, double *Easting, double *Northing)
#define POLAR_RADIUS_ERROR
#define POLAR_EASTING_ERROR
static double Polar_Delta_Northing
int Set_Polar_Stereographic_Parameters(double a, double f, double Latitude_of_True_Scale, double longitude_Down_from_Pole, double False_Easting, double False_Northing)
static double Polar_Origin_Lat
static double Polar_False_Easting
static double Polar_Delta_Easting
static double Southern_Hemisphere
int Convert_Polar_Stereographic_To_Geodetic(double Easting, double Northing, double *Latitude, double *longitude)
#define POLAR_ORIGIN_LAT_ERROR
#define POLAR_INV_F_ERROR
static double two_Polar_a
static double Polar_Origin_int
#define POLAR_ORIGIN_LON_ERROR
static double Polar_False_Northing
void Get_Polar_Stereographic_Parameters(double *a, double *f, double *Latitude_of_True_Scale, double *longitude_Down_from_Pole, double *False_Easting, double *False_Northing)
#define POLAR_NORTHING_ERROR