Changeset 13632 in josm
Legend:
 Unmodified
 Added
 Removed

trunk/data_nodist/projection/projectionregressiontestdata
r13628 r13632 18831 18831 EPSG:53028 18832 18832 ll 35.72259959292767 0.08011233833985498 18833 en 7232.05441044 9118 3972172.92287251218834 ll2 35.722 59959292767 0.0801123383398635918833 en 7232.0544104483415 3972172.9228725126 18834 ll2 35.722603125469135 0.08011233833985497 18835 18835 EPSG:5303 18836 18836 ll 59.74559228260094 92.1133124256515 
trunk/src/org/openstreetmap/josm/data/projection/proj/AlbersEqualArea.java
r12013 r13632 64 64 * Constants used by the spherical and elliptical Albers projection. 65 65 */ 66 private double n, c, rho0;66 private double n, n2, c, rho0; 67 67 68 68 /** … … 116 116 ec = 1.0  .5 * (1.0e2) * 117 117 Math.log((1.0  e) / (1.0 + e)) / e; 118 n2 = n * n; 118 119 this.n = n; 119 120 } … … 121 122 @Override 122 123 public double[] project(double y, double x) { 123 x *= n;124 double rho = c  n * qsfn(Math.sin(y));124 double theta = n * x; 125 double rho = c  (spherical ? n2 * Math.sin(y) : n * qsfn(Math.sin(y))); 125 126 if (rho < 0.0) { 126 127 if (rho > EPSILON) { … … 132 133 rho = Math.sqrt(rho) / n; 133 134 // CHECKSTYLE.OFF: SingleSpaceSeparator 134 y = rho0  rho * Math.cos( x);135 x = rho * Math.sin( x);135 y = rho0  rho * Math.cos(theta); 136 x = rho * Math.sin(theta); 136 137 // CHECKSTYLE.ON: SingleSpaceSeparator 137 138 return new double[] {x, y}; … … 150 151 x = Math.atan2(x, y) / n; 151 152 y = rho * n; 152 y = (c  y*y) / n; 153 if (Math.abs(y) <= ec) { 154 y = phi1(y); 153 if (spherical) { 154 y = aasin((c  y*y) / n2); 155 155 } else { 156 y = (y < 0.0) ? Math.PI/2.0 : Math.PI/2.0; 156 y = (c  y*y) / n; 157 if (Math.abs(y) <= ec) { 158 y = phi1(y); 159 } else { 160 y = (y < 0.0) ? Math.PI/2.0 : Math.PI/2.0; 161 } 157 162 } 158 163 } else { 
trunk/src/org/openstreetmap/josm/data/projection/proj/CassiniSoldner.java
r12013 r13632 33 33 34 34 /** 35 * Contants used for the forward and inverse transform for the eliptical 35 * Latitude of origin. 36 */ 37 private double phi0; 38 39 /** 40 * Constants used for the forward and inverse transform for the elliptical 36 41 * case of the CassiniSoldner. 37 42 */ … … 57 62 if (params.lat0 == null) 58 63 throw new ProjectionConfigurationException(tr("Parameter ''{0}'' required.", "lat_0")); 59 double latitudeOfOrigin= Utils.toRadians(params.lat0);60 ml0 = mlfn( latitudeOfOrigin, Math.sin(latitudeOfOrigin), Math.cos(latitudeOfOrigin));64 phi0 = Utils.toRadians(params.lat0); 65 ml0 = mlfn(phi0, Math.sin(phi0), Math.cos(phi0)); 61 66 } 62 67 63 68 @Override 64 69 public double[] project(double phi, double lam) { 65 double sinphi = Math.sin(phi); 66 double cosphi = Math.cos(phi); 70 if (spherical) { 71 double x = aasin(Math.cos(phi) * Math.sin(lam)); 72 double y = Math.atan2(Math.tan(phi), Math.cos(lam)); 73 return new double[] {x, y}; 74 } else { 75 double sinphi = Math.sin(phi); 76 double cosphi = Math.cos(phi); 67 77 68 double n = 1.0 / (Math.sqrt(1.0  e2 * sinphi * sinphi));69 double tn = Math.tan(phi);70 double t = tn * tn;71 double a1 = lam * cosphi;72 double c = cosphi * cosphi * e2 / (1  e2);73 double a2 = a1 * a1;78 double n = 1.0 / (Math.sqrt(1.0  e2 * sinphi * sinphi)); 79 double tn = Math.tan(phi); 80 double t = tn * tn; 81 double a1 = lam * cosphi; 82 double c = cosphi * cosphi * e2 / (1  e2); 83 double a2 = a1 * a1; 74 84 75 double x = n * a1 * (1.0  a2 * t * (C1  (8.0  t + 8.0 * c) * a2 * C2)); 76 double y = mlfn(phi, sinphi, cosphi)  ml0 + n * tn * a2 * (0.5 + (5.0  t + 6.0 * c) * a2 * C3); 77 return new double[] {x, y}; 85 double x = n * a1 * (1.0  a2 * t * (C1  (8.0  t + 8.0 * c) * a2 * C2)); 86 double y = mlfn(phi, sinphi, cosphi)  ml0 + n * tn * a2 * (0.5 + (5.0  t + 6.0 * c) * a2 * C3); 87 return new double[] {x, y}; 88 } 78 89 } 79 90 80 91 @Override 81 92 public double[] invproject(double x, double y) { 82 double ph1 = invMlfn(ml0 + y); 83 double tn = Math.tan(ph1); 84 double t = tn * tn; 85 double n = Math.sin(ph1); 86 double r = 1.0 / (1.0  e2 * n * n); 87 n = Math.sqrt(r); 88 r *= (1.0  e2) * n; 89 double dd = x / n; 90 double d2 = dd * dd; 91 double phi = ph1  (n * tn / r) * d2 * (0.5  (1.0 + 3.0 * t) * d2 * C3); 92 double lam = dd * (1.0 + t * d2 * (C4 + (1.0 + 3.0 * t) * d2 * C5)) / Math.cos(ph1); 93 return new double[] {phi, lam}; 93 if (spherical) { 94 double dd = y + phi0; 95 double phi = aasin(Math.sin(dd * Math.cos(x))); 96 double lam = Math.atan2(Math.tan(x), Math.cos(dd)); 97 return new double[] {phi, lam}; 98 } else { 99 double ph1 = invMlfn(ml0 + y); 100 double tn = Math.tan(ph1); 101 double t = tn * tn; 102 double n = Math.sin(ph1); 103 double r = 1.0 / (1.0  e2 * n * n); 104 n = Math.sqrt(r); 105 r *= (1.0  e2) * n; 106 double dd = x / n; 107 double d2 = dd * dd; 108 double phi = ph1  (n * tn / r) * d2 * (0.5  (1.0 + 3.0 * t) * d2 * C3); 109 double lam = dd * (1.0 + t * d2 * (C4 + (1.0 + 3.0 * t) * d2 * C5)) / Math.cos(ph1); 110 return new double[] {phi, lam}; 111 } 94 112 } 95 113
Note: See TracChangeset
for help on using the changeset viewer.