Ignore:
Timestamp:
2009-12-11T22:52:54+01:00 (14 years ago)
Author:
mjulius
Message:

Fixes #4083 - exception when copying relation with incomplete node
Fixes #4141 - relax conflict detection for coordinates; API only returns 7 decimals

File:
1 edited

Legend:

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

    r2570 r2612  
    22package org.openstreetmap.josm.data.coor;
    33
     4import static java.lang.Math.PI;
     5import static java.lang.Math.asin;
     6import static java.lang.Math.cos;
     7import static java.lang.Math.sin;
     8import static java.lang.Math.sqrt;
     9import static java.lang.Math.toRadians;
    410import static org.openstreetmap.josm.tools.I18n.tr;
    511
    612import java.text.DecimalFormat;
    713import java.text.NumberFormat;
    8 
    9 import static java.lang.Math.*;
    1014
    1115import org.openstreetmap.josm.Main;
     
    100104     */
    101105    public boolean equalsEpsilon(LatLon other) {
    102         final double p = 1/Projection.MAX_SERVER_PRECISION;
     106        final double p = Projection.MAX_SERVER_PRECISION;
    103107        return Math.abs(lat()-other.lat()) <= p && Math.abs(lon()-other.lon()) <= p;
    104108    }
     
    132136        double sinHalfLon = sin(toRadians(other.lon() - this.lon()) / 2);
    133137        double d = 2 * R * asin(
    134                             sqrt(sinHalfLat*sinHalfLat +
    135                             cos(toRadians(this.lat()))*cos(toRadians(other.lat()))*sinHalfLon*sinHalfLon));
    136         // For points opposite to each other on the sphere, 
     138                sqrt(sinHalfLat*sinHalfLat +
     139                        cos(toRadians(this.lat()))*cos(toRadians(other.lat()))*sinHalfLon*sinHalfLon));
     140        // For points opposite to each other on the sphere,
    137141        // rounding errors could make the argument of asin greater than 1
    138142        // (This should almost never happen.)
Note: See TracChangeset for help on using the changeset viewer.