Package org.insa.graphs.model
Class Point
java.lang.Object
org.insa.graphs.model.Point
public final class Point
extends java.lang.Object
Class representing a point (position) on Earth.
-
Field Summary
Fields Modifier and Type Field Description static double
EARTH_RADIUS
Approximated Earth radius (in meters). -
Constructor Summary
Constructors Constructor Description Point(float longitude, float latitude)
Create a new point corresponding to the given (longitude, latitude) position. -
Method Summary
Modifier and Type Method Description static double
distance(Point p1, Point p2)
Compute the distance in meters between the two given points.double
distanceTo(Point target)
Compute the distance from this point to the given pointfloat
getLatitude()
float
getLongitude()
java.lang.String
toString()
-
Field Details
-
EARTH_RADIUS
public static final double EARTH_RADIUSApproximated Earth radius (in meters).- See Also:
- Constant Field Values
-
-
Constructor Details
-
Point
public Point(float longitude, float latitude)Create a new point corresponding to the given (longitude, latitude) position.- Parameters:
longitude
- Longitude of the point (in degrees).latitude
- Latitude of the point (in degrees).
-
-
Method Details
-
distance
Compute the distance in meters between the two given points.- Parameters:
p1
- First point.p2
- second point.- Returns:
- Distance between the two given points (in meters).
-
getLongitude
public float getLongitude()- Returns:
- Longitude of this point (in degrees).
-
getLatitude
public float getLatitude()- Returns:
- Latitude of this point (in degrees).
-
distanceTo
Compute the distance from this point to the given point- Parameters:
target
- Target point to compute distance to.- Returns:
- Distance between this point and the target point, in meters.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-