public void testInverseMeridionalLength() { double[] en = null; double retval = 0.0; for (int n = 0; n < _exc2.length; n++) { en = MapTransformUtils.getLengthParams(_exc2[n]); retval = MapTransformUtils.invMeridLength(_args[n], _exc2[n], en); assertEquals(_expInvLength[n], retval, 1e-8); } }
double es = 1.0 - (b * b) / (a * a); _e = Math.sqrt(es); double m1 = MapTransformUtils.msfn(sinPhi, cosPhi, es); double ml1 = MapTransformUtils.tsfn(phi1, sinPhi, _e); temp = MapTransformUtils.msfn(Math.sin(phi2), Math.cos(phi2), es); _n = Math.log(m1 / temp); temp = MapTransformUtils.tsfn(phi2, Math.sin(phi2), _e); _n = _n / Math.log(ml1 / temp); temp = MapTransformUtils.tsfn(phi0, Math.sin(phi0), _e); _rho0 = _c * Math.pow(temp, _n);
geoPoint.lat = (float) MapTransformUtils.phi2(temp, _e); geoPoint.lon = (float) (Math.atan2(localX, localY) * _invN); } else {
public TMT(double[] parameterValues) { super(parameterValues[CENTRAL_MERIDIAN_INDEX], // lam0 parameterValues[FALSE_EASING_INDEX], // x0 parameterValues[FALSE_NORTHING_INDEX], // y0 parameterValues[SEMI_MAJOR_INDEX]); // a double a = parameterValues[SEMI_MAJOR_INDEX]; // a double b = parameterValues[SEMI_MINOR_INDEX]; // b _k0 = parameterValues[SCALE_FACTOR_INDEX]; // k0 _invK0 = 1.0 / _k0; double phi0 = parameterValues[LATITUDE_OF_ORIGIN_INDEX]; // phi0 _es = 1.0 - (b * b) / (a * a); _esp = _es / (1.0 - _es); _en = MapTransformUtils.getLengthParams(_es); phi0 = MathUtils.DTOR * phi0; _ml0 = MapTransformUtils.meridLength(phi0, Math.sin(phi0), Math.cos(phi0), _en); _parameterValues = new double[parameterValues.length]; System.arraycopy(parameterValues, 0, _parameterValues, 0, parameterValues.length); }
final double X = 2.0 * Math.atan(MapTransformUtils.ssfn(phi, sinphi, _e)) - HALFPI; break; case S_POLE: A = _akm1 * MapTransformUtils.tsfn(-phi, -sinphi, _e); mapPoint.setLocation(A, A * coslam); break; case N_POLE: A = _akm1 * MapTransformUtils.tsfn(phi, sinphi, _e); mapPoint.setLocation(A, -A * coslam); break;
/** * Worker method to be overridden by derived class. Performs the pure transformation. Prescaling, northing, * easting etc is calculated in this class. * * @param lat latitude of source location * @param lon longitude of source location * @param mapPoint * * @return the map co-ordinate */ @Override protected Point2D forward_impl(float lat, float lon, Point2D mapPoint) { final double phi = MathUtils.DTOR * lat; double lam = MathUtils.DTOR * lon; double rho; if (Math.abs(Math.abs(phi) - MathUtils.HALFPI) < _epsilon) { if ((phi * _n) < 0.0) { throw new IllegalArgumentException("Invalid parameter range"); } rho = 0.0; } else { double temp = MapTransformUtils.tsfn(phi, Math.sin(phi), _e); rho = _c * Math.pow(temp, _n); } lam = lam * _n; double tempX = _k0 * (rho * Math.sin(lam)); double tempY = _k0 * (_rho0 - rho * Math.cos(lam)); mapPoint.setLocation(tempX, tempY); return mapPoint; }
double _tempX = MapTransformUtils.invMeridLength(_ml0 + y * _invK0, _es, _en);
out = MapTransformUtils.msfn(sinPhi[n], cosPhi[n], es[n]); assertEquals(result[n], out, 1e-6);
public void testGetLengthParams() { double[] dRet = null; for (int n = 0; n < _exc1.length; n++) { dRet = MapTransformUtils.getLengthParams(_exc1[n]); assertEquals(5, dRet.length); for (int k = 0; k < dRet.length; k++) { assertEquals(_expLengthParams[n][k], dRet[k], 1e-8); } } }
/** * Calculates the inverse meridional distance for ellipsoid */ public static double invMeridLength(double arg, double es, double[] en) { double k = 1.0 / (1.0 - es); double s; double t; double phi = arg; for (int n = 0; n < _max_iter; n++) { s = Math.sin(phi); t = 1.0 - es * s * s; t = (meridLength(phi, s, Math.cos(phi), en) - arg) * t * Math.sqrt(t) * k; phi -= t; if (Math.abs(t) < _eps_11) { return phi; } } Debug.trace("MapTransformUtils: invMeridLength() - exceeded maximum iterations"); return phi; }
case OBLIQ: double t = Math.sin(phi0); final double X = 2.0 * Math.atan(MapTransformUtils.ssfn(phi0, t, _e)) - HALFPI; t *= _e; _akm1 = 2.0 * k0 * Math.cos(phi0) / Math.sqrt(1.0 - t * t);
out = MapTransformUtils.tsfn(phi[n], sinPhi[n], e[n]); assertEquals(result[n], out, 1e-6);
(5.0 + t * (t - 18.0) + n * (14.0 - 58.0 * t) + _fc7 * a1s * (61.0 + t * (t * (179.0 - t) - 479.0))))); ml = MapTransformUtils.meridLength(phi, sinPhi, cosPhi, _en); double tempY = _k0 * (ml - _ml0 + sinPhi * a1 * lam * _fc2 * (1.0 + _fc4 * a1s * (5.0 - t + n * (9.0 + 4.0 * n) + _fc6 * a1s *
public void testPhi2() { double[] ts = {9.5905648772470e-006, 1.8541564827703e-005, 0.00014589008548276, 0.00039416643426756 }; double e = 0.081819190842621; double[] result = {1.5707772739278, 1.5707594916372, 1.5705064977368, 1.5700132654843 }; double out; for (int n = 0; n < ts.length; n++) { out = MapTransformUtils.phi2(ts[n], e); assertEquals(result[n], out, 1e-6); } } }