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 point
    float getLatitude()  
    float getLongitude()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • 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

      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