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 int
compareTo
(@NotNull Coordinate o) static @NotNull Coordinate
fromArray
(double[] coords) Creates a Coordinate from an array of doubles.static @NotNull Coordinate
fromArray
(float[] coords) Creates a Coordinate from an array of floats.static @NotNull Coordinate
fromArray
(int[] coords) Creates a Coordinate from an array of integers.@NotNull Dimension
Gets the dimension of the Coordinate.double
getDistance
(@NotNull Coordinate other) Gets the distance between two Coordinates.double
Gets the magnitude of the Coordinate.int
hashCode()
@NotNull String
toString()
-
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:
compareTo
in interfaceComparable<Coordinate>
-