Ticket #14346: gamma.diff
File gamma.diff, 2.0 KB (added by , 7 years ago) |
---|
-
src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java
106 106 */ 107 107 private double ml0; 108 108 109 /** 110 * The rectified bearing of the central line, in radians. 111 */ 112 protected double rectifiedGridAngle; 113 114 /** 115 * Sine and Cosine values for the coordinate system rotation angle 116 */ 117 private double sinrot, cosrot; 118 109 119 @Override 110 120 public String getName() { 111 121 return tr("Transverse Mercator"); … … 124 134 eb2 = params.ellps.eb2; 125 135 latitudeOfOrigin = params.lat0 == null ? 0 : Math.toRadians(params.lat0); 126 136 ml0 = mlfn(latitudeOfOrigin, Math.sin(latitudeOfOrigin), Math.cos(latitudeOfOrigin)); 137 138 if (params.gamma != null) { 139 rectifiedGridAngle = Math.toRadians(params.gamma); 140 } else { 141 rectifiedGridAngle = 0.0; 142 } 143 sinrot = Math.sin(rectifiedGridAngle); 144 cosrot = Math.cos(rectifiedGridAngle); 145 127 146 } 128 147 129 148 @Override … … 130 149 public double[] project(double y, double x) { 131 150 double sinphi = Math.sin(y); 132 151 double cosphi = Math.cos(y); 152 double u, v; 133 153 134 154 double t = (Math.abs(cosphi) > EPSILON) ? sinphi/cosphi : 0; 135 155 t *= t; … … 150 170 FC5 * als * (5.0 + t*(t - 18.0) + n*(14.0 - 58.0*t) + 151 171 FC7 * als * (61.0+ t*(t*(179.0 - t) - 479.0))))); 152 172 173 u=x; v=y; 174 x = v * cosrot + u * sinrot; 175 y = u * cosrot - v * sinrot; 176 153 177 return new double[] {x, y}; 154 178 } 155 179 156 180 @Override 157 181 public double[] invproject(double x, double y) { 182 double v = x * cosrot - y * sinrot; 183 double u = y * cosrot + x * sinrot; 184 x=u; y=v; 185 158 186 double phi = invMlfn(ml0 + y); 159 187 160 188 if (Math.abs(phi) >= Math.PI/2) {