Interface Coordinate

All Superinterfaces:
Comparable<Coordinate>
All Known Implementing Classes:
Coordinate2D, Coordinate3D

public interface Coordinate extends Comparable<Coordinate>
Represents a Game Coordinate.
  • Method Details

    • getMagnitude

      double getMagnitude()
      Gets the magnitude of the Coordinate.
      Returns:
      Coordinate Magnitude
    • getDistance

      double getDistance(@NotNull @NotNull Coordinate other) throws IllegalArgumentException
      Gets the distance between two Coordinates.
      Parameters:
      other - Other Coordinate
      Returns:
      Distance between Coordinates
      Throws:
      IllegalArgumentException - if the Coordinates are not the same dimension
    • getDimension

      @NotNull @NotNull Dimension getDimension()
      Gets the dimension of the Coordinate.
      Returns:
      Coordinate Dimension
    • toString

      @NotNull @NotNull String toString()
      Overrides:
      toString in class Object
    • hashCode

      int hashCode()
      Overrides:
      hashCode in class Object
    • fromArray

      @NotNull static @NotNull Coordinate fromArray(int[] coords)
      Creates a Coordinate from an array of integers.
      Parameters:
      coords - Coordinate Array
      Returns:
      A 2D or 3D Coordinate, depending on array size
    • fromArray

      @NotNull static @NotNull Coordinate fromArray(float[] coords)
      Creates a Coordinate from an array of floats.
      Parameters:
      coords - Coordinate Array
      Returns:
      A 2D or 3D Coordinate, depending on array size
    • fromArray

      @NotNull static @NotNull Coordinate fromArray(double[] coords)
      Creates a Coordinate from an array of doubles.
      Parameters:
      coords - Coordinate Array
      Returns:
      A 2D or 3D Coordinate, depending on array size
    • compareTo

      default int compareTo(@NotNull @NotNull Coordinate o)
      Specified by:
      compareTo in interface Comparable<Coordinate>