 Timestamp:
 20180622T23:18:21+02:00 (13 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r13173 r13966 242 242 243 243 /** 244 * Returns the heading that you have to use to get from this lat/lon to another.245 *246 * Angle starts from north and increases counterclockwise (!), PI/2 means west.247 * You can get usual clockwise angle from {@link #bearing(LatLon)} method.248 * This method is kept as deprecated because it is called from many plugins.249 *250 * (I don't know the original source of this formula, but see251 * <a href="https://math.stackexchange.com/questions/720/howtocalculateaheadingontheearthssurface">this question</a>252 * for some hints how it is derived.)253 *254 * @deprecated see bearing method255 * @param other the "destination" position256 * @return heading in radians in the range 0 <= hd < 2*PI257 */258 @Deprecated259 public double heading(LatLon other) {260 double hd = atan2(sin(toRadians(this.lon()  other.lon())) * cos(toRadians(other.lat())),261 cos(toRadians(this.lat())) * sin(toRadians(other.lat())) 262 sin(toRadians(this.lat())) * cos(toRadians(other.lat())) * cos(toRadians(this.lon()  other.lon())));263 hd %= 2 * PI;264 if (hd < 0) {265 hd += 2 * PI;266 }267 return hd;268 }269 270 /**271 244 * Returns bearing from this point to another. 272 245 * 273 246 * Angle starts from north and increases clockwise, PI/2 means east. 274 * Old deprecated method {@link #heading(LatLon)} used unusual reverse angle.275 247 * 276 248 * Please note that reverse bearing (from other point to this point) should NOT be … … 282 254 * @param other the "destination" position 283 255 * @return heading in radians in the range 0 <= hd < 2*PI 256 * @since 9796 284 257 */ 285 258 public double bearing(LatLon other) {
Note: See TracChangeset
for help on using the changeset viewer.