Ignore:
Timestamp:
2010-08-26T23:56:47+02:00 (14 years ago)
Author:
bastiK
Message:

see #5327 (patch by sbrunner) - Swissgrild uses approximate formulas => better use exact formulas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/projection/UTM_France_DOM.java

    r3343 r3473  
    348348     */
    349349    private LatLon cart2LatLon(double X, double Y, double Z, Ellipsoid ell) {
    350         double norm = Math.sqrt(X * X + Y * Y);
    351         double lg = 2.0 * Math.atan(Y / (X + norm));
    352         double lt = Math.atan(Z / (norm * (1.0 - (ell.a * ell.e2 / Math.sqrt(X * X + Y * Y + Z * Z)))));
    353         double delta = 1.0;
    354         while (delta > epsilon) {
    355             double s2 = Math.sin(lt);
    356             s2 *= s2;
    357             double l = Math.atan((Z / norm)
    358                     / (1.0 - (ell.a * ell.e2 * Math.cos(lt) / (norm * Math.sqrt(1.0 - ell.e2 * s2)))));
    359             delta = Math.abs(l - lt);
    360             lt = l;
    361         }
    362         double s2 = Math.sin(lt);
    363         s2 *= s2;
    364         // h = norm / Math.cos(lt) - ell.a / Math.sqrt(1.0 - ell.e2 * s2);
    365         return new LatLon(lt, lg);
     350        double[] XYZ = {X, Y, Z};
     351        LatLon coord = ell.cart2LatLon(XYZ, epsilon);
     352        return new LatLon(Math.toRadians(coord.lat()), Math.toRadians(coord.lon()));
    366353    }
    367354
Note: See TracChangeset for help on using the changeset viewer.