Changeset 2612 in josm for trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
- Timestamp:
- 2009-12-11T22:52:54+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r2570 r2612 2 2 package org.openstreetmap.josm.data.coor; 3 3 4 import static java.lang.Math.PI; 5 import static java.lang.Math.asin; 6 import static java.lang.Math.cos; 7 import static java.lang.Math.sin; 8 import static java.lang.Math.sqrt; 9 import static java.lang.Math.toRadians; 4 10 import static org.openstreetmap.josm.tools.I18n.tr; 5 11 6 12 import java.text.DecimalFormat; 7 13 import java.text.NumberFormat; 8 9 import static java.lang.Math.*;10 14 11 15 import org.openstreetmap.josm.Main; … … 100 104 */ 101 105 public boolean equalsEpsilon(LatLon other) { 102 final double p = 1/Projection.MAX_SERVER_PRECISION;106 final double p = Projection.MAX_SERVER_PRECISION; 103 107 return Math.abs(lat()-other.lat()) <= p && Math.abs(lon()-other.lon()) <= p; 104 108 } … … 132 136 double sinHalfLon = sin(toRadians(other.lon() - this.lon()) / 2); 133 137 double d = 2 * R * asin( 134 sqrt(sinHalfLat*sinHalfLat +135 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, 137 141 // rounding errors could make the argument of asin greater than 1 138 142 // (This should almost never happen.)
Note:
See TracChangeset
for help on using the changeset viewer.