Changeset 12736 in josm
 Timestamp:
 20170905T18:18:30+02:00 (3 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r12735 r12736 348 348 } 349 349 return d; 350 }351 352 /**353 * Returns the heading that you have to use to get from this lat/lon to another.354 *355 * Angle starts from north and increases counterclockwise (!), PI/2 means west.356 * You can get usual clockwise angle from {@link #bearing(LatLon)} method.357 * This method is kept as deprecated because it is called from many plugins.358 *359 * (I don't know the original source of this formula, but see360 * <a href="https://math.stackexchange.com/questions/720/howtocalculateaheadingontheearthssurface">this question</a>361 * for some hints how it is derived.)362 *363 * @deprecated see bearing method364 * @param other the "destination" position365 * @return heading in radians in the range 0 <= hd < 2*PI366 */367 @Deprecated368 public double heading(LatLon other) {369 double hd = atan2(sin(toRadians(this.lon()  other.lon())) * cos(toRadians(other.lat())),370 cos(toRadians(this.lat())) * sin(toRadians(other.lat())) 371 sin(toRadians(this.lat())) * cos(toRadians(other.lat())) * cos(toRadians(this.lon()  other.lon())));372 hd %= 2 * PI;373 if (hd < 0) {374 hd += 2 * PI;375 }376 return hd;377 350 } 378 351
Note: See TracChangeset
for help on using the changeset viewer.