Ignore:
Timestamp:
2016-01-18T22:48:40+01:00 (8 years ago)
Author:
bastiK
Message:

see #12186 - add Oblique Mercator projection
(imports pieces of code from the Geotools project)

File:
1 edited

Legend:

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

    r9432 r9532  
    2525
    2626    /**
     27     * Difference allowed in iterative computations.
     28     */
     29    private static final double ITERATION_TOLERANCE = 1E-10;
     30
     31    /**
    2732     * Relative iteration precision used in the <code>mlfn</code> method
    2833     */
     
    153158
    154159    /**
     160     * Iteratively solve equation (7-9) from Snyder.
     161     */
     162    final double cphi2(final double ts) {
     163        final double eccnth = 0.5 * e;
     164        double phi = (Math.PI/2) - 2.0 * Math.atan(ts);
     165        for (int i=0; i<MAXIMUM_ITERATIONS; i++) {
     166            final double con  = e * Math.sin(phi);
     167            final double dphi = (Math.PI/2) - 2.0*Math.atan(ts * Math.pow((1-con)/(1+con), eccnth)) - phi;
     168            phi += dphi;
     169            if (Math.abs(dphi) <= ITERATION_TOLERANCE) {
     170                return phi;
     171            }
     172        }
     173        throw new RuntimeException("no convergence");
     174    }
     175
     176    /**
    155177     * Computes function <code>f(s,c,e²) = c/sqrt(1 - s²&times;e²)</code> needed for the true scale
    156178     * latitude (Snyder 14-15), where <var>s</var> and <var>c</var> are the sine and cosine of
Note: See TracChangeset for help on using the changeset viewer.