Changeset 6165 in josm


Ignore:
Timestamp:
2013-08-21T01:32:39+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8987 - Move distanceSq() from EastNorth to Coordinate to fix broken plugins (comes from old Point2D)

Location:
trunk/src/org/openstreetmap/josm/data/coor
Files:
2 edited

Legend:

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

    r6163 r6165  
    1414 * EastNorth.
    1515 *
    16  * @author imi
     16 * @since 6162
    1717 */
    1818abstract class Coordinate implements Serializable {
     
    3737    public double getY() {
    3838        return y;
     39    }
     40
     41    /**
     42     * Returns the square of the euclidean distance from this {@code Coordinate} to a specified {@code Coordinate}.
     43     *
     44     * @param coor the specified coordinate to be measured against this {@code Coordinate}
     45     * @return the square of the euclidean distance from this {@code Coordinate} to a specified {@code Coordinate}
     46     */
     47    public double distanceSq(final Coordinate coor) {
     48        final double dx = this.x-coor.x;
     49        final double dy = this.y-coor.y;
     50        return dx*dx + dy*dy;
    3951    }
    4052
  • trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java

    r6162 r6165  
    5454        final double dy = this.y-en2.y;
    5555        return Math.sqrt(dx*dx + dy*dy);
    56     }
    57 
    58     /**
    59      * Counts square of euclidean distance between this and other EastNorth.
    60      *
    61      * @param en2 other EastNorth
    62      * @return square of distance between this and other EastNorth
    63      */
    64     public double distanceSq(final EastNorth en2) {
    65         final double dx = this.x-en2.x;
    66         final double dy = this.y-en2.y;
    67         return dx*dx + dy*dy;
    6856    }
    6957
Note: See TracChangeset for help on using the changeset viewer.