Changeset 10033 in josm for trunk/src/org/openstreetmap/josm/data/coor
- Timestamp:
- 2016-03-23T21:52:44+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r9983 r10033 9 9 import static java.lang.Math.sqrt; 10 10 import static java.lang.Math.toRadians; 11 import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84; 11 12 import static org.openstreetmap.josm.tools.I18n.trc; 12 13 … … 325 326 */ 326 327 public double greatCircleDistance(LatLon other) { 327 double R = 6378135;328 328 double sinHalfLat = sin(toRadians(other.lat() - this.lat()) / 2); 329 329 double sinHalfLon = sin(toRadians(other.lon() - this.lon()) / 2); 330 double d = 2 * R* asin(330 double d = 2 * WGS84.a * asin( 331 331 sqrt(sinHalfLat*sinHalfLat + 332 332 cos(toRadians(this.lat()))*cos(toRadians(other.lat()))*sinHalfLon*sinHalfLon)); … … 336 336 if (java.lang.Double.isNaN(d)) { 337 337 Main.error("NaN in greatCircleDistance"); 338 d = PI * R;338 d = PI * WGS84.a; 339 339 } 340 340 return d;
Note:
See TracChangeset
for help on using the changeset viewer.