Package xyz.calcugames.levelz.coord
Interface Coordinate
- All Superinterfaces:
Comparable<Coordinate>
- All Known Implementing Classes:
Coordinate2D,Coordinate3D
Represents a Game Coordinate.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intcompareTo(@NotNull Coordinate o) static @NotNull CoordinatefromArray(double[] coords) Creates a Coordinate from an array of doubles.static @NotNull CoordinatefromArray(float[] coords) Creates a Coordinate from an array of floats.static @NotNull CoordinatefromArray(int[] coords) Creates a Coordinate from an array of integers.@NotNull DimensionGets the dimension of the Coordinate.doublegetDistance(@NotNull Coordinate other) Gets the distance between two Coordinates.doubleGets the magnitude of the Coordinate.inthashCode()@NotNull StringtoString()
-
Method Details
-
getMagnitude
double getMagnitude()Gets the magnitude of the Coordinate.- Returns:
- Coordinate Magnitude
-
getDistance
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
Gets the dimension of the Coordinate.- Returns:
- Coordinate Dimension
-
toString
-
hashCode
int hashCode() -
fromArray
Creates a Coordinate from an array of integers. -
fromArray
Creates a Coordinate from an array of floats. -
fromArray
Creates a Coordinate from an array of doubles. -
compareTo
- Specified by:
compareToin interfaceComparable<Coordinate>
-