/** * Iteratively solve equation (7-9) from Snyder. This is the converse of {@link #tsfn}. * The input should be a positive number, otherwise the result will be either outside * the [-π/2 ... π/2] range, or will be NaN. Its behavior at some particular points is: * <p> * <ul> * <li>If {@code ts} is zero, then the result is close to π/2.</li> * <li>If {@code ts} is 1, then the result is close to zero.</li> * <li>If {@code ts} is positive infinity, then the result is close to -π/2.</li> * </ul> * * @param ts The value returned by {@link #tsfn}. * @return The latitude in radians. * @throws ProjectionException if the iteration does not converge. */ final double cphi2(final double ts) throws ProjectionException { // == φ(ts) final double he = 0.5 * eccentricity; double φ = (PI/2) - 2.0 * atan(ts); for (int i=0; i<MAXIMUM_ITERATIONS; i++) { final double con = eccentricity * sin(φ); final double dphi = abs(φ - (φ = PI/2 - 2.0*atan(ts * pow((1-con)/(1+con), he)))); if (dphi <= ITERATION_TOLERANCE) { return φ; } } if (isNaN(ts)) { return NaN; } throw new ProjectionException(Errors.format(Errors.Keys.NoConvergence)); }
throw new ProjectionException(Errors.format(Errors.Keys.NoConvergence));
throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence));
/** * Calculates the latitude ({@code φ}) from a meridian distance. * Determines φ to a tenth of {@value #ITERATION_TOLERANCE} radians. * * @param delta meridian distance to calculate latitude for. * @return The latitude of the meridian distance. * @throws ProjectionException if the iteration does not converge. */ final double inv_mlfn(final double delta) throws ProjectionException { final double k = 1/(1 - eccentricitySquared); double φ = delta; int i=MAXIMUM_ITERATIONS; do { // rarely goes over 5 iterations final double s = sin(φ); double t = 1 - eccentricitySquared * (s*s); t = (mlfn(φ, s, cos(φ)) - delta) * (t * sqrt(t)) * k; φ -= t; if (abs(t) < ITERATION_TOLERANCE/10) { return φ; } } while (--i >= 0); throw new ProjectionException(Errors.format(Errors.Keys.NoConvergence)); } }
throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence));
throw new ProjectionException(Errors.format(Errors.Keys.TestFailure_3, variable,
throw new ProjectionException(Errors.format(Errors.Keys.NoConvergence));
do { if (--i < 0) { throw new ProjectionException(Errors.format(Errors.Keys.NoConvergence));
if (abs(λ) > PI/2) { throw new ProjectionException(Errors.format(Errors.Keys.OutsideDomainOfValidity));
do { if (--nbIte < 0) { throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence)); throw new ProjectionException(e);
do { if (--i < 0) { throw new ProjectionException(Errors.format(Errors.Keys.NoConvergence));
if (sinc > 1) { if (sinc - 1 > ANGLE_TOLERANCE) { throw new ProjectionException(Errors.format(Errors.Keys.PointOutsideHemisphere));
throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence));
throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence));
if (abs(λ) > PI/2) { throw new ProjectionException(Errors.format(Errors.Keys.OutsideDomainOfValidity));
throw new ProjectionException(Errors.format(Errors.Keys.PointOutsideHemisphere));
throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence));
throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence));
/** * Computes φ using the iterative method used by USGS. * This is the second part of the {@link ConformalProjection#φ(double)} method. * * @param t the {@code expOfSouthing} parameter value. * @return the latitude (in radians) for the given parameter. * @throws ProjectionException if the iteration does not converge. */ public double byIterativeMethod(final double t) throws ProjectionException { final double hℯ = 0.5 * eccentricity; double φ = (PI/2) - 2*atan(t); // Snyder (7-11) for (int it=0; it < NormalizedProjection.MAXIMUM_ITERATIONS; it++) { // Iteratively solve equation (7-9) from Snyder final double ℯsinφ = eccentricity * sin(φ); final double Δφ = φ - (φ = PI/2 - 2*atan(t * pow((1 - ℯsinφ)/(1 + ℯsinφ), hℯ))); if (abs(Δφ) <= NormalizedProjection.ITERATION_TOLERANCE) { return φ; } } if (Double.isNaN(t)) { return Double.NaN; } throw new ProjectionException(Resources.format(Resources.Keys.NoConvergence)); }
throw new ProjectionException(c[i].x + " outside of (" + x.getMinimumValue() + "," + x.getMaximumValue() + ")"); throw new ProjectionException(c[i].y + " outside of (" + y.getMinimumValue() + "," + y.getMaximumValue() + ")");