Package org.openstreetmap.josm.data.coor
Class EastNorth
- java.lang.Object
-
- org.openstreetmap.josm.data.coor.Coordinate
-
- org.openstreetmap.josm.data.coor.EastNorth
-
- All Implemented Interfaces:
java.io.Serializable
public class EastNorth extends Coordinate
Northing, Easting of the projected coordinates. This class is immutable.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDstatic EastNorthZEROA zero constant-
Fields inherited from class org.openstreetmap.josm.data.coor.Coordinate
x, y
-
-
Constructor Summary
Constructors Constructor Description EastNorth(double east, double north)Constructs a newEastNorth.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EastNorthadd(double dEast, double dNorth)Adds an offset to thisEastNorthinstance and returns the result.EastNorthadd(EastNorth other)Adds the coordinates of another EastNorth instance to this one.doubledistance(EastNorth en)Returns the euclidean distance from thisEastNorthto a specifiedEastNorth.doubledistanceSq(EastNorth en)Returns the square of the euclidean distance from thisEastNorthto a specifiedEastNorth.doubleeast()Returns easting.booleanequalsEpsilon(EastNorth other, double e)Compares two EastNorth valuesEastNorthgetCenter(EastNorth en2)Gets the center between twoEastNorthinstances.doubleheading(EastNorth other)Returns the heading, in radians, that you have to use to get from this EastNorth to another.doubleheading(EastNorth other, double refHeading)Behaves exactly likeheading(EastNorth)ifrefHeadingis0.0, otherwise gives a heading not relative to north (0.0).EastNorthinterpolate(EastNorth en2, double proportion)Does a linear interpolation between two EastNorth instances.booleanisValid()Replies true if east and north are different from Double.NaN and not infinitedoublelength()Counts length (distance from [0,0]) of this.doublenorth()Returns northing.EastNorthrotate(EastNorth pivot, double angle)Returns an EastNorth representing this EastNorth rotated around a given EastNorth by a given angleEastNorthscale(double s)Scales thisEastNorthinstance to a given factor and returns the result.EastNorthsubtract(EastNorth other)Subtracts an east/north value from this point.java.lang.StringtoString()-
Methods inherited from class org.openstreetmap.josm.data.coor.Coordinate
distance, distance, distanceSq, distanceSq, equals, getX, getY, hashCode
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EastNorth
public EastNorth(double east, double north)
Constructs a newEastNorth.- Parameters:
east- eastingnorth- northing
-
-
Method Detail
-
east
public double east()
Returns easting.- Returns:
- easting
-
north
public double north()
Returns northing.- Returns:
- northing
-
add
public EastNorth add(double dEast, double dNorth)
Adds an offset to thisEastNorthinstance and returns the result.- Parameters:
dEast- The offset to add in east direction.dNorth- The offset to add in north direction.- Returns:
- The result.
-
add
public EastNorth add(EastNorth other)
Adds the coordinates of another EastNorth instance to this one.- Parameters:
other- The other instance.- Returns:
- The new EastNorth position.
-
subtract
public EastNorth subtract(EastNorth other)
Subtracts an east/north value from this point.- Parameters:
other- The other value to subtract from this.- Returns:
- A point with the new coordinates.
-
scale
public EastNorth scale(double s)
Scales thisEastNorthinstance to a given factor and returns the result.- Parameters:
s- factor- Returns:
- The result.
-
interpolate
public EastNorth interpolate(EastNorth en2, double proportion)
Does a linear interpolation between two EastNorth instances.- Parameters:
en2- The other EstNort instance.proportion- The proportion the other instance influences the result.- Returns:
- The new
EastNorthposition.
-
getCenter
public EastNorth getCenter(EastNorth en2)
Gets the center between twoEastNorthinstances.- Parameters:
en2- The other instance.- Returns:
- The center between this and the other instance.
-
distance
public double distance(EastNorth en)
Returns the euclidean distance from thisEastNorthto a specifiedEastNorth.- Parameters:
en- the specified coordinate to be measured against thisEastNorth- Returns:
- the euclidean distance from this
EastNorthto a specifiedEastNorth - Since:
- 6166
-
distanceSq
public double distanceSq(EastNorth en)
Returns the square of the euclidean distance from thisEastNorthto a specifiedEastNorth.- Parameters:
en- the specified coordinate to be measured against thisEastNorth- Returns:
- the square of the euclidean distance from this
EastNorthto a specifiedEastNorth - Since:
- 6166
-
length
public double length()
Counts length (distance from [0,0]) of this.- Returns:
- length of this
-
heading
public double heading(EastNorth other)
Returns the heading, in radians, that you have to use to get from this EastNorth to another. Heading is mapped into [0, 2pi)- Parameters:
other- the "destination" position- Returns:
- heading
-
heading
public double heading(EastNorth other, double refHeading)
Behaves exactly likeheading(EastNorth)ifrefHeadingis0.0, otherwise gives a heading not relative to north (0.0). It replies the radians needed to add torefHeadingto get from this EastNorth to another.- Parameters:
other- the "destination" positionrefHeading- origin ("false" north if different from0.0)- Returns:
- heading with respect to
refHeadingas origin - Since:
- 18468
-
isValid
public boolean isValid()
Replies true if east and north are different from Double.NaN and not infinite- Returns:
- true if east and north are different from Double.NaN and not infinite
-
rotate
public EastNorth rotate(EastNorth pivot, double angle)
Returns an EastNorth representing this EastNorth rotated around a given EastNorth by a given angle- Parameters:
pivot- the center of the rotationangle- the angle of the rotation- Returns:
- EastNorth rotated object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equalsEpsilon
public boolean equalsEpsilon(EastNorth other, double e)
Compares two EastNorth values- Parameters:
other- other east.northe- epsilon- Returns:
- true if "x" and "y" values are within epsilon
eof each other
-
-