Class 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.
    • Field Detail

      • EARTH_RADIUS

        public static final double EARTH_RADIUS
        Approximated Earth radius (in meters).
        See Also:
        Constant Field Values
    • Constructor Detail

      • 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 Detail

      • distance

        public static double distance​(Point p1,
                                      Point p2)
        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

        public double distanceTo​(Point target)
        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 class java.lang.Object