Changeset 26410 in osm for applications/editors/josm/plugins/proj4j/src
- Timestamp:
- 2011-07-28T11:41:23+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/proj4j/src/org/osgeo/proj4j/proj/TransverseMercatorProjection.java
r26409 r26410 17 17 /* 18 18 * This file was semi-automatically converted from the public-domain USGS PROJ source. 19 * 20 * Bernhard Jenny, February 2 2010: Corrected code for spherical case in 21 * projectInverse, added isConformal. 22 * 27 September 2010: added missing tests to forward spherical, removed 23 * initialization code in constructor. 19 24 */ 20 25 package org.osgeo.proj4j.proj; … … 155 160 public ProjCoordinate projectInverse(double x, double y, ProjCoordinate out) { 156 161 if (spherical) { 157 double h = Math.exp(x / scaleFactor); 158 double g = .5 * (h - 1. / h); 159 h = Math.cos(projectionLatitude + y / scaleFactor); 160 out.y = ProjectionMath.asin(Math.sqrt((1. - h*h) / (1. + g*g))); 161 if (y < 0) 162 out.y = -out.y; 163 out.x = Math.atan2(g, h); 162 /* 163 Original code 164 x = Math.exp(x / scaleFactor); 165 y = .5 * (x - 1. / x); 166 x = Math.cos(projectionLatitude + y / scaleFactor); 167 out.y = MapMath.asin(Math.sqrt((1. - x * x) / (1. + y * y))); 168 if (y < 0) { 169 out.y = -out.y; 170 } 171 out.x = Math.atan2(y, x); 172 */ 173 174 // new code by Bernhard Jenny, February 2 2010 175 double D = y / scaleFactor + projectionLatitude; 176 double xp = x / scaleFactor; 177 178 out.y = Math.asin(Math.sin(D) / Math.cosh(xp)); 179 out.x = Math.atan2(Math.sinh(xp), Math.cos(D)); 164 180 } else { 165 181 double n, con, cosphi, d, ds, sinphi, t; … … 197 213 return true; 198 214 } 215 216 public boolean isConformal() { 217 return true; 218 } 199 219 200 220 public String toString() {
Note:
See TracChangeset
for help on using the changeset viewer.