Ignore:
Timestamp:
2016-03-23T21:52:44+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #12632 - Use WGS84 Ellipsoid constant instead of fixed value for R

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r9983 r10033  
    99import static java.lang.Math.sqrt;
    1010import static java.lang.Math.toRadians;
     11import static org.openstreetmap.josm.data.projection.Ellipsoid.WGS84;
    1112import static org.openstreetmap.josm.tools.I18n.trc;
    1213
     
    325326     */
    326327    public double greatCircleDistance(LatLon other) {
    327         double R = 6378135;
    328328        double sinHalfLat = sin(toRadians(other.lat() - this.lat()) / 2);
    329329        double sinHalfLon = sin(toRadians(other.lon() - this.lon()) / 2);
    330         double d = 2 * R * asin(
     330        double d = 2 * WGS84.a * asin(
    331331                sqrt(sinHalfLat*sinHalfLat +
    332332                        cos(toRadians(this.lat()))*cos(toRadians(other.lat()))*sinHalfLon*sinHalfLon));
     
    336336        if (java.lang.Double.isNaN(d)) {
    337337            Main.error("NaN in greatCircleDistance");
    338             d = PI * R;
     338            d = PI * WGS84.a;
    339339        }
    340340        return d;
Note: See TracChangeset for help on using the changeset viewer.