/* Initialize the Polar Stereographic projection --------------------------------------------*/ long psinvint ( double r_maj, /* major axis */ double r_min, /* minor axis */ double c_lon, /* center longitude */ double c_lat, /* center latitude */ double false_east, /* x offset in meters */ double false_north /* y offset in meters */ ) { double temp; /* temporary variable */ double con1; /* temporary angle */ double sinphi; /* sin value */ double cosphi; /* cos value */ double es; /* eccentricity squared */ r_major = r_maj; r_minor = r_min; false_easting = false_east; false_northing = false_north; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e4 = e4fn(e); center_lon = c_lon; center_lat = c_lat; if (c_lat < 0) fac = -1.0; else fac = 1.0; ind = 0; if (fabs(fabs(c_lat) - HALF_PI) > EPSLN) { ind = 1; con1 = fac * center_lat; gctp_sincos(con1,&sinphi,&cosphi); mcs = msfnz(e,sinphi,cosphi); tcs = tsfnz(e,con1,sinphi); } /* Report parameters to the user -----------------------------*/ ptitle("POLAR STEREOGRAPHIC"); radius2(r_major, r_minor); cenlon(center_lon); offsetp(false_east,false_north); return(GCTP_OK); }
// Initialize the Polar Stereographic projection long Projectoid::psinvint( double r_maj, // major axis double r_min, // minor axis double c_lon, // center longitude double c_lat, // center latitude double false_east, // x offset in meters double false_north) // y offset in meters { double temp; // temporary variable double con1; // temporary angle double sinphi; // sin value double cosphi; // cos value double es; // eccentricity squared r_major = r_maj; r_minor = r_min; false_easting = false_east; false_northing = false_north; temp = r_minor / r_major; es = 1.0 - SQUARE(temp); e = sqrt(es); e4 = e4fn(e); center_lon = c_lon; center_lat = c_lat; if (c_lat < 0) fac = -1.0; else fac = 1.0; ind = 0; if (fabs(fabs(c_lat) - HALF_PI) > EPSLN) { ind = 1; con1 = fac * center_lat; sincos(con1, &sinphi, &cosphi); mcs = msfnz(e, sinphi, cosphi); tcs = tsfnz(e, con1, sinphi); } // Report parameters to the user ptitle("POLAR STEREOGRAPHIC"); radius2(r_major, r_minor); cenlon(center_lon); offsetp(false_east, false_north); InverseOK[WCS_PROJECTIONCODE_PS] = 1; InverseTransform = &Projectoid::psinv; return(OK); }