Class CartesianCoordinate

java.lang.Object
org.naviqore.utils.spatial.CartesianCoordinate
All Implemented Interfaces:
Coordinate

public class CartesianCoordinate extends Object implements Coordinate
  • Constructor Details

    • CartesianCoordinate

      public CartesianCoordinate(double x, double y)
  • Method Details

    • getFirstComponent

      public double getFirstComponent()
      Description copied from interface: Coordinate
      Examples for the first component are latitude or X coordinate.
      Specified by:
      getFirstComponent in interface Coordinate
      Returns:
      the first component of the 2D-coordinate
    • getSecondComponent

      public double getSecondComponent()
      Description copied from interface: Coordinate
      Examples for the first component are longitude or Y coordinate.
      Specified by:
      getSecondComponent in interface Coordinate
      Returns:
      the second component of the 2D-coordinate
    • distanceTo

      public double distanceTo(Coordinate other)
      Description copied from interface: Coordinate
      Calculates the distance to another Coordinate object.

      Note: Implementations may raise an IllegalArgumentException if the other Coordinate object is not of the same type.

      Specified by:
      distanceTo in interface Coordinate
    • distanceTo

      public double distanceTo(double x, double y)
      Description copied from interface: Coordinate
      Calculates the distance to another point specified by its components.
      Specified by:
      distanceTo in interface Coordinate
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object